0

I have two (virtual) servers running CentOS with Docker installed.

We have installed IPTables and everything works as expected.

I then adapt the service file: /usr/lib/systemd/system/docker.service

And set the execute command to not adjust the firewall.

ExecStart=/usr/bin/dockerd --iptables=false 

Now if I start a docker container and try to curl an address I get the error curl: (6) Could not resolve host: google.com; Unknown error

I have the following networks:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 00:23:7d:e9:c3:58 brd ff:ff:ff:ff:ff:ff
3: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default
    link/ether 02:42:ff:62:c5:5f brd ff:ff:ff:ff:ff:ff
7: vethc4abff6@if6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP mode DEFAULT group default
    link/ether 02:ba:1c:a3:6d:fc brd ff:ff:ff:ff:ff:ff link-netnsid 0

And IPTable rules:

iptables -A INPUT -i docker0 -j ACCEPT
iptables -A FORWARD -i docker0 -o eth0 -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT

I expected this to allow internet access from the containers - and this seems to work perfectly on the other CentOS server.

What am I missing?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.