0

I'm beginning with Docker.

I want to run a docker mysql container, this is my docker-compose.yml

version: "3"
services:

    mysql:
        build: docker/mysql
        ports:
            - "33306:3306"
        environment:
            MYSQL_ROOT_PASSWORD: root
        volumes:
            - "~/lab/work/attikae/sqlstorage:/var/lib/mysql"

When I run this composer being in the "work-attikae" docker-machine ( see it is ACTIVE ):

 nathan@macbook-pro-de-nathan  ~  docker-machine ls
NAME           ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER    ERRORS
default        -        virtualbox   Running   tcp://192.168.99.100:2376           v1.13.1
work-attikae   *        virtualbox   Running   tcp://192.168.99.103:2376           v1.13.1

The folder "~/lab/work/attikae/sqlstorage" is totally empty and nothing is written in it.

BUT ! When I am on the "Docker for mac env" ( see that none of the machines are ACTIVE ) :

 nathan@macbook-pro-de-nathan  ~  docker-machine ls
NAME           ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER    ERRORS
default        -        virtualbox   Running   tcp://192.168.99.100:2376           v1.13.1
work-attikae   -        virtualbox   Running   tcp://192.168.99.103:2376           v1.13.1

Everyting works properly and sql data are well written in "~/lab/work/attikae/sqlstorage".

So, I wanted to use docker-machine to train myself and use multiple ips, but ... only Docker for mac works for volumes, did I missed something ?

NathanVss
  • 634
  • 5
  • 16
  • Can you clarify what you're actually using? `docker-machine` is a part of Docker Toolbox, and "Docker for Mac" is a completely different thing that works differently from Docker Toolbox. Are you using Docker Toolbox on the Mac and just referring to that as "Docker for Mac"? Or actually using "Docker for Mac"? – Dan Lowe Feb 11 '17 at 16:58
  • I want to use both of them, that's not possible ? – NathanVss Feb 11 '17 at 18:33
  • AFAIK it is possible, but you need to be more clear in your question which you are talking about for each part of the question, so people can accurately understand what you're doing and answer. – Dan Lowe Feb 11 '17 at 18:52
  • Also make sure you have a recent version of `docker-compose`. Older versions did not understand the tilde (`~`). – Dan Lowe Feb 11 '17 at 18:54
  • Everything is up-to-date. In the first case I use docker-machine, in this one it seems that the mysql container can't write in "~/lab/work/attikae/sqlstorage" because it remain empty after running it. In the second case I'm using "Docker for Mac" which works, the same container writes in "~/lab/work/attikae/sqlstorage" folder. Is that more clear ? – NathanVss Feb 11 '17 at 19:06
  • And you're sure you're on a recent version of `docker-compose` for both situations? e.g. `docker-compose --version`. The most recent release is 1.11.1. It ships with Docker for Mac, I'm not sure about Docker Toolbox. Alternately, specifying the full path is probably a good idea. – Dan Lowe Feb 11 '17 at 19:44
  • Yes I have the most recent release you specified. The problem remain even with absolute path .. Maybe I have to configure some sharing volume for docker machines ? – NathanVss Feb 11 '17 at 23:58
  • It looks like Docker Toolbox mounts `/Users` into the Linux VM. But if you are using your homedir and thus the absolute path is `/Users//...` then I would think the absolute path should be working. – Dan Lowe Feb 12 '17 at 01:05

0 Answers0