Issues when changing between networks

Expected behavior

When changing between different connections (in my case wi-fi at home, office, coffee shop etc) new Docker containers have incorrect networking settings.

Actual behavior

Occasionally docker containers will have weird networking issues, such as inability to connect to yum/apt repositories.

So the example that I’ve experienced (including a few minutes ago) is open MacBook, connect to wifi, try to run a new container, hits issue such as:

wget -O /tmp/puppet.deb http://apt.puppetlabs.com/puppetlabs-release-trusty.deb
  Resolving apt.puppetlabs.com (apt.puppetlabs.com)...   failed: Name or service not known.
  wget: unable to resolve host address 'apt.puppetlabs.com'

Restarting Docker and running container again solves the issue.

Information

  • 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

Steps to reproduce the behavior

Not sure the best way to reproduce, Macbook and change between different wi-fi connections?