2

Following instructions I've installed docker on ubuntu 13.04 (and 12.04 + 3.8 kernel), pulled the base container and started a shell inside it. It got a private IP and can ping it's default gateway but can't connect to any host outside, so no apt-get for me.

I have "net.ipv4.conf.all.forwarding = 1" in my sysctl and have POSTROUTING rules in iptables/nat table.

Did the docker installer forgot to add some rules or i'm missing something?

wiz
  • 140

2 Answers2

0

Do you use the docker network?

in docker network, you can decide which type of network applies to your container.

even you can make your own network setting

for bridge example can use this command with your own favorite IP range:

sudo docker network create \
    --driver=bridge \
    --subnet=172.19.0.0/16 \
    --gateway=172.19.0.1 \
    custom_bridge_network

after adding that use the --network option on the docker run command to add a network to your container

but for your problem, I suggest u use macvlan network on your docker containers Goodluck https://docs.docker.com/network/macvlan/

0

Do you have the MASQUERADE rule?

Can you try to start the daemon with docker -d -b testbr0 and try again?

This will create a new bridge and setup all iptables rules for it.

If it works, it probably mean a iptables -t nat -F occurred at some point and the nat rules for docker have been lost. You can either manually recreate them or more easily, remove the docker bridge and restart docker :)

  • it has a rule in a nat table:

    -A POSTROUTING -s 10.0.42.0/24 ! -d 10.0.42.0/24 -j MASQUERADE

    The 10.../24 address is for that new testbr0 interface.

    The network isn't available in a container started with this docker instance.

    – wiz May 29 '13 at 20:08
  • By any chance, would the issue be DNS linked? you can try to run a docker instance with 'docker run -dns 8.8.8.8 ping google.com'. If not, I suggest you submit an issue on the docker github. –  May 29 '13 at 23:08