title: Docker DB Migration/Deployment to DigitalOcean
body: <p>Warning: I am fairly new to docker and cloud hosting, this is likely a dumb question.</p>
  
  <p>I have a local web app which has 3 images associated with it, the app itself, the db and a phpmyadmin image. All works well locally, and if I transfer all the files to my digital ocean droplet and bring up my containers it works fine there as well, but this is not how I want to deploy having every file from every library residing in my droplet.</p>
  
  <p>I have been experimenting with creating a docker-machine on my droplet and deploying my containers remotely to it. This seems to work fine other than the fact that my db image does not reference my database and is simply an empty db. I tried to migrate the db in this fashion which I saw in a tutorial:</p>
  
  <pre><code>docker-compose run --rm web db:create db:migrate
  </code></pre>
  
  <p>But got the following error, I assume this is because my dev machine is running Windows 10 not Linux, but I cannot find anywhere what the equivalent command would be for a Windows machine. </p>
  
  <pre><code>Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused "exec: \"db:create\": executable file not found in $PATH": unknown
  </code></pre>
  
  <p>I know I am probably missing something really stupid and easy but I am having difficulties figuring out how to migrate the data for my db image. Thanks in advance.</p>
  
  <p>UPDATE:
  As requested here is my docker-compose:</p>
  
  <pre><code>    version: "3.4"
  
  services:
    phpmyadmin:
      image: phpmyadmin/phpmyadmin
      environment:
        - PMA_ARBITRARY=1
        - PMA_HOST=db
      restart: always
      ports:
        - 80:80
      volumes:
        - /sessions
      depends_on:
        - db
    db:
      image: mysql:latest
      environment: 
        MYSQL_ROOT_PASSWORD: mypass
        MYSQL_DATABASE: mydb
      ports:
        - "3306:3306"
      volumes:
        - ./data:/docker-entrypoint-initdb.d
      restart: always
    web:
      depends_on:
        - db
      build: .
      ports:
        - "8080:8080"
      restart: always
  volumes:
    data:
  </code></pre>
  
  <p>UPDATE #2:
  transfered db file to /docker-entrypoint-initdb.d (I tried this yesterday too but couldn't get it working) and created a new production docker-compose-prod.yml I must be missing something still though as the DB is still empty. Below is my new docker-compose-prod.yml:</p>
  
  <pre><code>version: "3.4"
  
  services:
    phpmyadmin:
      image: phpmyadmin/phpmyadmin
      environment:
        - PMA_ARBITRARY=1
        - PMA_HOST=db
      restart: always
      ports:
        - 80:80
      volumes:
        - /sessions
      depends_on:
        - db
    db:
      image: mysql:latest
      environment: 
        MYSQL_ROOT_PASSWORD: mypass
        MYSQL_DATABASE: mydb
      ports:
        - "3306:3306"
      volumes:
        - /docker-entrypoint-initdb.d
      restart: always
    web:
      depends_on:
        - db
      build: .
      ports:
        - "8080:8080"
      restart: always
  </code></pre>