"Connection refused" running docker-osx-dev with docker-machine
rkuzsma opened this issue · comments
docker-osx-dev cannot connect to my docker-machine to be able to rsync files.
I'm on OSX 10.11.2, using docker-machine, not boot2docker.
Relevant output when running docker-osx-dev -l DEBUG
2016-04-10 20:38:30 [DEBUG] Starting sync paths: /Users/snipped/foo
2016-04-10 20:38:30 [DEBUG] rsync --archive --log-format 'Syncing %n: %i' --delete --omit-dir-times --inplace --whole-file -l --rsh="ssh -i /Users/snipped/.docker/machine/machines/default/id_rsa -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" /Users/snipped/foo docker@:/Users/snipped 2>&1 | grep -v "^Warning: Permanently added"
2016-04-10 20:38:30 [INFO] ssh: connect to host port 22: Connection refused
2016-04-10 20:38:30 [INFO] rsync: connection unexpectedly closed (0 bytes received so far) [sender]
2016-04-10 20:38:30 [INFO] rsync error: error in rsync protocol data stream (code 12) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-47/rsync/io.c(453) [sender=2.6.9]
2016-04-10 20:38:30 [INFO] Initial sync done
2016-04-10 20:38:30 [INFO] Watching: /Users/snipped/foo
This part of the rsync
command looks like the IP address got truncated: docker@:/Users/snipped
My docker-machine inspect
doesn't return an IPAddress. Could be related to docker-machine issue 1041
- not all drivers expose an IP Address, and to make matters worse, those that do sometimes spell IPAddress differently.
$ docker-machine inspect
{
"ConfigVersion": 3,
"Driver": {
"IPAddress": "",
"MachineName": "default",
"SSHUser": "docker",
...
This command works, though:
$ docker-machine ip
192.168.99.100
Maybe tweaking this line of docker-osx-dev to use docker-machine ip
will fix the issue:
DOCKER_HOST_IP=$(inspect_docker_machine "{{.Driver.IPAddress}}" || inspect_docker_machine "{{.Driver.Driver.IPAddress}}")
Thanks for reporting. It looks like Docker driers are pretty inconsistent (and not backwards compatible) with what the configuration they expose. You can see we've already had to support two different ways of looking up the IP, and now, it's broken yet again! I'll check out your PR shortly.