Troubleshoot docker connectivity to external network

This was a DNS server issue — the default server (as pre-configured in Docker in Ubuntu) could be pinged but not reached via nslookup.

I’m having trouble to connect to the internet from a container on my local installation.

  • docker cp from host to container is not working
  • Check for updated package via yum in Dockerfile
  • Is it a bad idea to use docker to run a front end build process during development?
  • fatal: destination path '/home/ipy/ipynotebooks/soccer' already exists and is not an empty directory
  • Can not start docker on lubuntu “cannot start container: exec format error”
  • Why is Internal memory in java Native Memory Tracking increasing
  • My system

    ifconfig looks fine

    $ docker run -ti twelly/ifconfigme ifconfig
    eth0      Link encap:Ethernet  HWaddr f2:bd:a6:53:6f:5f  
              inet addr:  Bcast:  Mask:
              inet6 addr: fe80::f0bd:a6ff:fe53:6f5f/64 Scope:Link
              UP BROADCAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:2 overruns:0 frame:0
              TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:0 (0.0 B)  TX bytes:90 (90.0 B)
    lo        Link encap:Local Loopback  
              inet addr:  Mask:
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:65536  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

    I can ping

    $ docker run -ti twelly/ifconfigme ping -c 3
    PING ( 56(84) bytes of data.
    64 bytes from icmp_seq=1 ttl=56 time=33.6 ms
    64 bytes from icmp_seq=2 ttl=56 time=33.6 ms
    64 bytes from icmp_seq=3 ttl=56 time=33.5 ms
    --- ping statistics ---
    3 packets transmitted, 3 received, 0% packet loss, time 2002ms
    rtt min/avg/max/mdev = 33.525/33.597/33.650/0.218 ms

    ping exits with failure after a timeout

    $ time docker run -ti twelly/ifconfigme ping -c 3
    ping: unknown host
    real    0m40.267s
    user    0m0.014s
    sys 0m0.012s

    I have the same results with debian:latest, but I cannot test ifconfig because it’s not installed there.

    New VM

    The same setting works in a new Ubuntu Utopic 14.10 virtual machine.


    Vagrant.configure(2) do |config| = ""
      config.vm.provision "shell", inline: "apt-get update && apt-get upgrade -y"
      config.vm.provision "shell", inline: "apt-get install -y && adduser vagrant docker"


    $ vagrant up && vagrant ssh -c "docker run -ti twelly/ifconfigme ping -c 3"


    What am I possibly doing wrong? How to troubleshoot this?

  • Why is a shell within a docker container showing dmesg content from the host?
  • Sharing a configuration file to multiple docker containers
  • Am I using flyway wrong?
  • High Level Docker and Dockerfile Volume/writeout understanding
  • chown docker volumes on host (possibly through docker-compose)
  • Intermittent Connection Errors for Docker Swarm Services
  • One Solution collect form web for “Troubleshoot docker connectivity to external network”

    You will have to specify that you don’t want that the connectivity to be managed by the container. Use --net=host in your run command.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.