Expected behavior
In native linux docker, and in docker toolbox (virtualbox), and with earlier beta 8 it was possible to connect to other containers using localhost
, from a container that has mounted the /var/run/docker.sock
socket.
Specifically I am using the consul registrator image GitHub - gliderlabs/registrator: Service registry bridge for Docker with pluggable adapters
and the example command line works in all other docker environments except in beta 9
$ docker run -d \
--name=registrator \
--net=host \
--volume=/var/run/docker.sock:/tmp/docker.sock \
gliderlabs/registrator:latest \
consul://localhost:8500
Update:
I now realise that the relevant setting is probably net=host, not the docker.sock mounting. But still, the problem is the same. I am also attaching a reproducable docker-compose.yml
Actual behavior
Can not connect to consul container using localhost adress
Information
- the output of:
pinata diagnose -u
on OSX
pinata diagnose -u
OS X: version 10.10.5 (build: 14F27)
Docker.app: version v1.11.0-beta9
Running diagnostic tests:
[OK] docker-cli
[OK] Moby booted
[OK] driver.amd64-linux
[OK] vmnetd
[OK] osxfs
[OK] db
[OK] slirp
[OK] menubar
[OK] environment
[OK] Docker
[OK] VT-x
Docker logs are being collected into /tmp/20160429-091710.tar.gz
Most specific failure is: No error was detected
Your unique id is: CAC737C7-7929-4413-BE2D-A2E944F6C282
Please quote this in all correspondence.
- `DockerDebugInfo.ps1` using Powershell on Windows
- a reproducible case if this is a bug, Dockerfiles FTW
registrator:
image: gliderlabs/registrator
command: -retry-attempts -1 -retry-interval 500 consul://localhost:8500
net: host
volumes:
- "/var/run/docker.sock:/tmp/docker.sock"
consul:
image: gliderlabs/consul-server
entrypoint: /bin/consul agent -bootstrap -server -data-dir /var/consul -client 0.0.0.0
ports:
- "8400:8400"
- "8500:8500"
- "8600:53/udp"
- page URL if this is a docs issue or the name of a man page
- host distribution and version ( OSX 10.10.x, OSX 10.11.x, Windows, etc )
Steps to reproduce the behavior
Run the embedded docker-compose.yml
the expected output is something like
registrator_1 | 2016/04/29 07:37:45 Starting registrator v7 ...
registrator_1 | 2016/04/29 07:37:45 Using consul adapter: consul://localhost:8500
registrator_1 | 2016/04/29 07:37:45 Connecting to backend (0/-1)
registrator_1 | 2016/04/29 07:37:46 consul: current leader
registrator_1 | 2016/04/29 07:37:46 Listening for Docker events ...
registrator_1 | 2016/04/29 07:37:46 Syncing services on 2 containers
registrator_1 | 2016/04/29 07:37:46 added: 2c22a7941225 docker:case_consul_1:8500
registrator_1 | 2016/04/29 07:37:46 ignored: 2c22a7941225 port 8302 not published on host
registrator_1 | 2016/04/29 07:37:46 ignored: 2c22a7941225 port 8600 not published on host
registrator_1 | 2016/04/29 07:37:46 ignored: 2c22a7941225 port 8300 not published on host
registrator_1 | 2016/04/29 07:37:46 added: 2c22a7941225 docker:case_consul_1:53:udp
registrator_1 | 2016/04/29 07:37:46 added: 2c22a7941225 docker:case_consul_1:8400
registrator_1 | 2016/04/29 07:37:46 ignored: 2c22a7941225 port 8600 not published on host
registrator_1 | 2016/04/29 07:37:46 ignored: 2c22a7941225 port 8301 not published on host
registrator_1 | 2016/04/29 07:37:46 ignored: 2c22a7941225 port 8302 not published on host
registrator_1 | 2016/04/29 07:37:46 ignored: 2c22a7941225 port 8301 not published on host
registrator_1 | 2016/04/29 07:37:46 ignored: ed047dc191ab no published ports
but when it is not working you get
registrator_1 | 2016/04/29 07:33:53 Connecting to backend (1/-1)
registrator_1 | 2016/04/29 07:33:54 Connecting to backend (2/-1)
registrator_1 | 2016/04/29 07:33:54 Connecting to backend (3/-1)
registrator_1 | 2016/04/29 07:33:55 Connecting to backend (4/-1)
registrator_1 | 2016/04/29 07:33:56 Connecting to backend (5/-1)
registrator_1 | 2016/04/29 07:33:56 Connecting to backend (6/-1)
...