Closed richardtape closed 8 years ago
As an addition, if I docker exec -i -t e2c1eaa5f86a /bin/bash
into the container and then
cat /var/www/index.html
I can see that the file has been updated with the change I made on the host. But they are not reflected in the browser. Maybe I'm being very, very stupid, but I thought this was exactly what docker-osx-dev was designed to do?
Could it be that by default the /Users/
directory is a shared folder? And that because I'm sharing something else already in that directory, that docker-osx-dev isn't syncing?
Hello Richard
What url are you using to access the file ?
For exemple :
192.168.99.101/index.html will be the same as /var/www/index.html (if the nginx vhost has been configure to use that path)
As I can see there is no docker-compose.yml and no -s flag.
So he is not watching anything.
Try again with the -s file or use a docker-compose.yml file in order to sync the volumes.
Simp'
Hi, thanks so much for getting back to me. Yes I'm using 192.168.99.101/index.html to view the file. And yes, it's the same as /var/www/index.html (the nginx config has been set to show that).
Sorry, I'm being silly, but if I'm already in the shared directory, I don't need the -s
flag do I?
On my Mac, the files are in /Users/<snip>/sites/ctlt/docker-test/data/
So if I cd /Users/<snip>/sites/ctlt/docker-test/data/
and then docker-osx-dev
that's the same as running docker-osx-dev -s /Users/<snip>/sites/ctlt/docker-test/data/
no?
If I manually run docker-osx-dev -s /Users/<snip>/sites/ctlt/docker-test/data
it does the same thing, i.e.
2015-11-30 12:30:30 [INFO] Using sync paths from command line args: /Users/<snip>/sites/ctlt/docker-test/data
2015-11-30 12:30:30 [INFO] Complete list of paths to sync: /Users/<snip>/sites/ctlt/docker-test/data
2015-11-30 12:30:30 [INFO] Using default exclude paths: .git
2015-11-30 12:30:30 [INFO] Complete list of paths to exclude: .git
2015-11-30 12:30:30 [INFO] Complete list of paths to include:
2015-11-30 12:30:30 [INFO] Starting docker-osx-dev file syncing
2015-11-30 12:30:30 [INFO] Testing if docker machine is running
If I then edit /Users/
The part that says "Testing if docker machine is running" is executing the following command:
docker-machine status $DOCKER_MACHINE_NAME
What happens if you run that separately in a terminal?
From my initial comment:
Manually ran
docker-machine status spaces
and got Running
(spaces is the name of $DOCKER_MACHINE_NAME and, to confirm, docker-machine status $DOCKER_MACHINE_NAME
also returns Running and echo $DOCKER_MACHINE_NAME
returns spaces)
I see. If it's not the docker-machine status
call, then it must be hanging on something else. You could try running docker-osx-dev with the debug logging flag (-l DEBUG
) to see if you get more output. If that doesn't do it, the next best option is to manually add log statements to the script itself to see where it's hanging.
docker-osx-dev -l DEBUG
2015-11-30 12:51:15 [INFO] Using default sync paths: .
2015-11-30 12:51:15 [INFO] Complete list of paths to sync: /Users/<snip>/sites/ctlt/docker-test/data
2015-11-30 12:51:15 [INFO] Using default exclude paths: .git
2015-11-30 12:51:15 [INFO] Complete list of paths to exclude: .git
2015-11-30 12:51:15 [INFO] Complete list of paths to include:
2015-11-30 12:51:15 [INFO] Starting docker-osx-dev file syncing
2015-11-30 12:51:15 [INFO] Testing if docker machine is running
I'll throw some logs into the file and see what happens
OK, got it.
It was hanging on
DOCKER_HOST_USER=$(inspect_docker_machine "{{.Driver.SSHUser}}")
DOCKER_HOST_IP=$(inspect_docker_machine "{{.Driver.IPAddress}}")
in configure_docker_machine()
I ran an inspect and it shows me that the correct location should be
DOCKER_HOST_USER=$(inspect_docker_machine "{{.Driver.Driver.SSHUser}}")
DOCKER_HOST_IP=$(inspect_docker_machine "{{.Driver.Driver.IPAddress}}")
(Driver.Driver.
I changed that, then ran docker-osx-dev
and it gave me a LOT more output, including noticing that there were already shared folders (as expected) and then, ultimately,
2015-11-30 13:24:58 [INFO] Syncing data/: cd+++++++
2015-11-30 13:24:58 [INFO] Syncing data/index.html: <f+++++++
2015-11-30 13:24:58 [INFO] Initial sync done
2015-11-30 13:24:58 [INFO] Watching: /Users/<snip>/sites/ctlt/docker-test/data
2015-11-30 13:24:58 [DEBUG] fswatch -0 /Users/<snip>/sites/ctlt/docker-test/data
Perhaps the location of the SSHUser and IPAddress changed recently in the output from a docker-machine inspect?
@richardtape: Thanks for digging in!
@lukaso: Any thoughts?
I can make a PR here if you're interested?
Probably do something like you did with DOCKER_MACHINE_STORE_PATH
by doing an || check?
Sure, that would be great! Perhaps the Docker folks are changing these config paths and we just need to keep up from time to time.@lukaso, feel free to pipe in if you have any thoughts.
@brikis98 I think the docker people are simply moving things around under the hood in this API without documentation. I wonder if we should open an issue asking them to at least document when they make the changes. Or we should build slightly more abstraction into here though it's not looking too bad yet.
First, thanks so much for putting this together. It is precisely what I've been struggling with over the weekend.
Following the steps in the readme, I created a machine using
docker-machine
thusdocker-machine create --driver virtualbox spaces
eval "$(docker-machine env spaces)"
docker-osx-dev install
docker-osx-dev
Manually ran
docker-machine status spaces
and gotRunning
Then, in another tab
docker run -d -p 80:80 -v /Users/<snip>/sites/ctlt/docker-test/data:/var/www richardtape/spacesnginx:latest nginx
docker ps -a
docker-machine ip spaces
192.168.99.101
Visit
192.168.99.101
in a browser and I see the index.html file in my shared data directory. However, if I update that file on the host (i.e. using Atom on my host mac to update/Users/<snip>/sites/ctlt/docker-test/data/index.html
) the changes aren't reflected when I refresh the browser.OSX: 10.10.5 Virtualbox: 5.0.10 Docker version 1.9.1, build a34a1d5 fswatch 1.7.0 readlink (GNU coreutils) 8.24
I'm probably doing something stupid...