NAT issues when defining multiple networks in docker-compose.yml

Expected behavior

When using Docker for Mac with NAT networking and running docker-compose up using a v2 formatted docker-compose file with multiple networks defined, containers with port exposures should be available at docker.local:<PORT>

Actual behavior

Multiple networks defined and attached to services causes requests to docker.local:<PORT> to timeout / fail. Defining multiple networks doesn’t cause the issue but attaching services to more than one network does.

If you use a single network, requests to docker.local: succeed. I’ve been able to reproduce this issue consistently. See below.

Information

Note: running as a standard OSX User (no sudo).

$ pinata diagnose -u
OS X: version 10.11.4 (build: 15E65)
Docker.app: version v1.10.3-beta5
Running diagnostic tests:
[OK] docker-cli
[OK] Moby booted
[OK] driver.amd64-linux
[OK] vmnetd
[OK] lofs
[OK] osxfs
[OK] db
[OK] slirp
[OK] menubar
[OK] environment
[OK] Docker
[OK] VT-x
Error exec: cat /var/log/system.log | grep docker -i > “/tmp/20160401-113257/docker-system.log”: exit 1

Steps to reproduce the behavior

  1. git clone https://github.com/docker/docker-birthday-3
  2. cd example-voting-app
  3. docker-compose up
  4. Try hitting docker.local:5000 or docker.local:5001 in a browser.

If you comment out front-tier network and only use back-tier network for all services / components, requests will be routed correctly.

Hi,

Thanks for your report – I’m able to reproduce the same issue with the example-voting-app. I’m also seeing some non-determinism: if I start/stop the app a lot, sometimes one of the ports works, and sometimes both work. It seems there may be a problem with the docker-proxy subprocess – I’ll investigate further!

Thanks,
Dave

Awesome, happy to help. Docker for Mac is a huge win for local dev. :beers:

FYI, this seems to be fixed in Version 1.11.0-beta6 (build: 5404). I haven’t been able to reproduce since upgrading. Thanks!