You are not logged in.

#1 2015-08-24 06:10:59

dejy
Member
Registered: 2014-03-18
Posts: 67

Docker container can't connect to Host's network after recent Update

Here are my most recent relevant updates /var/log/pacman.log - it doesn't seem like anything critical.

[2015-08-20 10:20] [ALPM] upgraded linux-headers (4.1.4-1 -> 4.1.5-1)
[2015-08-20 10:19] [ALPM] upgraded docker (1:1.7.1-2 -> 1:1.8.1-1)

Nevertheless I can no longer connect to the internet from with a Docker container's network. E.g. This works.

docker run -it --net=host  centos:centos7 ping www.google.com

PING www.google.com (74.125.200.99) 56(84) bytes of data.
64 bytes from sa-in-f99.1e100.net (74.125.200.99): icmp_seq=1 ttl=48 time=6.37 ms
64 bytes from sa-in-f99.1e100.net (74.125.200.99): icmp_seq=2 ttl=48 time=4.35 ms

This hangs:

docker run -it centos:centos7 ping www.google.com

I have made no alterations to docker configuration. What are the related packages I should be looking to downgrade?



Here is docker inspect output:

[
{
    "Id": "69a93f025160f9d01a9dadb4665a99fb810410eea4a167bdf5a30f9d2bedc027",
    "Created": "2015-08-24T06:11:16.855432762Z",
    "Path": "ping",
    "Args": [
        "www.google.com"
    ],
    "State": {
        "Running": true,
        "Paused": false,
        "Restarting": false,
        "OOMKilled": false,
        "Dead": false,
        "Pid": 13113,
        "ExitCode": 0,
        "Error": "",
        "StartedAt": "2015-08-24T06:11:17.330538345Z",
        "FinishedAt": "0001-01-01T00:00:00Z"
    },
    "Image": "7322fbe74aa5632b33a400959867c8ac4290e9c5112877a7754be70cfe5d66e9",
    "NetworkSettings": {
        "Bridge": "",
        "EndpointID": "fa601ee4bb50a1b414627179ea8565d0b0579f508b4db796c85017f4e1edf699",
        "Gateway": "172.17.42.1",
        "GlobalIPv6Address": "",
        "GlobalIPv6PrefixLen": 0,
        "HairpinMode": false,
        "IPAddress": "172.17.0.8",
        "IPPrefixLen": 16,
        "IPv6Gateway": "",
        "LinkLocalIPv6Address": "",
        "LinkLocalIPv6PrefixLen": 0,
        "MacAddress": "02:42:ac:11:00:08",
        "NetworkID": "c83a586d6a62abc0071a723cf14166975a61a22e18fea9f19defd37a5eb44990",
        "PortMapping": null,
        "Ports": {},
        "SandboxKey": "/var/run/docker/netns/69a93f025160",
        "SecondaryIPAddresses": null,
        "SecondaryIPv6Addresses": null
    },
    "ResolvConfPath": "/var/lib/docker/containers/69a93f025160f9d01a9dadb4665a99fb810410eea4a167bdf5a30f9d2bedc027/resolv.conf",
    "HostnamePath": "/var/lib/docker/containers/69a93f025160f9d01a9dadb4665a99fb810410eea4a167bdf5a30f9d2bedc027/hostname",
    "HostsPath": "/var/lib/docker/containers/69a93f025160f9d01a9dadb4665a99fb810410eea4a167bdf5a30f9d2bedc027/hosts",
    "LogPath": "/var/lib/docker/containers/69a93f025160f9d01a9dadb4665a99fb810410eea4a167bdf5a30f9d2bedc027/69a93f025160f9d01a9dadb4665a99fb810410eea4a167bdf5a30f9d2bedc027-json.log",
    "Name": "/reverent_wilson",
    "RestartCount": 0,
    "Driver": "devicemapper",
    "ExecDriver": "native-0.2",
    "MountLabel": "",
    "ProcessLabel": "",
    "AppArmorProfile": "",
    "ExecIDs": null,
    "HostConfig": {
        "Binds": null,
        "ContainerIDFile": "",
        "LxcConf": [],
        "Memory": 0,
        "MemorySwap": 0,
        "CpuShares": 0,
        "CpuPeriod": 0,
        "CpusetCpus": "",
        "CpusetMems": "",
        "CpuQuota": 0,
        "BlkioWeight": 0,
        "OomKillDisable": false,
        "MemorySwappiness": -1,
        "Privileged": false,
        "PortBindings": {},
        "Links": null,
        "PublishAllPorts": false,
        "Dns": null,
        "DnsSearch": null,
        "ExtraHosts": null,
        "VolumesFrom": null,
        "Devices": [],
        "NetworkMode": "default",
        "IpcMode": "",
        "PidMode": "",
        "UTSMode": "",
        "CapAdd": null,
        "CapDrop": null,
        "GroupAdd": null,
        "RestartPolicy": {
            "Name": "no",
            "MaximumRetryCount": 0
        },
        "SecurityOpt": null,
        "ReadonlyRootfs": false,
        "Ulimits": null,
        "LogConfig": {
            "Type": "json-file",
            "Config": {}
        },
        "CgroupParent": "",
        "ConsoleSize": [
            0,
            0
        ]
    },
    "GraphDriver": {
        "Name": "devicemapper",
        "Data": {
            "DeviceId": "250",
            "DeviceName": "docker-8:1-1993157-69a93f025160f9d01a9dadb4665a99fb810410eea4a167bdf5a30f9d2bedc027",
            "DeviceSize": "10737418240"
        }
    },
    "Mounts": [],
    "Config": {
        "Hostname": "69a93f025160",
        "Domainname": "",
        "User": "",
        "AttachStdin": true,
        "AttachStdout": true,
        "AttachStderr": true,
        "ExposedPorts": null,
        "PublishService": "",
        "Tty": true,
        "OpenStdin": true,
        "StdinOnce": true,
        "Env": null,
        "Cmd": [
            "ping",
            "www.google.com"
        ],
        "Image": "centos:centos7",
        "Volumes": null,
        "VolumeDriver": "",
        "WorkingDir": "",
        "Entrypoint": null,
        "NetworkDisabled": false,
        "MacAddress": "",
        "OnBuild": null,
        "Labels": {}
    }
}
]

Last edited by dejy (2015-08-24 06:18:31)

Offline

#2 2015-08-24 09:04:10

enrique
Member
Registered: 2005-10-25
Posts: 95
Website

Re: Docker container can't connect to Host's network after recent Update

I'm having the same problem, downgrading to 1.7 fixes the problem, so it must be something introduced with 1.8.

Things I have checked:

  • Ping the gateway ip (172.17.42.1) from inside a container.

  • "ip addr" inside the container says the interface is up

  • iptables on the host looks ok

  • docker-proxy is running on the host

  • a diff between the output from docker inspect on 1.7 and 1.8 does not give any clues


Kind regards, enrique

Offline

#3 2015-08-24 10:28:25

aborigines
Member
Registered: 2013-03-09
Posts: 4

Re: Docker container can't connect to Host's network after recent Update

hi all

system disable ip4 for docker0
enable ip4 on your network manager

ex.
before
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet6 fe80::42:c2ff:fe22:d47d  prefixlen 64  scopeid 0x20<link>

after
docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1280
        inet 172.17.42.1  netmask 255.255.0.0  broadcast 0.0.0.0
        inet6 fe80::42:c2ff:fe22:d47d  prefixlen 64  scopeid 0x20<link>

TAhFVmxot6Mte7Zl0OlKkOgOJAb4t_rb_qsoAbifpII=w505-h492-no

Last edited by aborigines (2015-08-24 10:43:04)

Offline

#4 2015-08-25 02:31:50

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: Docker container can't connect to Host's network after recent Update

For what it's worth, I'm not seeing this issue (using Ubuntu container, not CentOS, but that shouldn't make a difference). Tried on two machines (laptop - NetworkManager, server - systemd-networkd), no special setups except I use a different docker0 network address on my laptop.
On the server:

~ $ docker run -it --rm ubuntu ping -c2 google.com
PING google.com (173.194.33.174) 56(84) bytes of data.
64 bytes from sea09s18-in-f14.1e100.net (173.194.33.174): icmp_seq=1 ttl=54 time=10.5 ms
64 bytes from sea09s18-in-f14.1e100.net (173.194.33.174): icmp_seq=2 ttl=54 time=9.69 ms
 
--- google.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 9.693/10.138/10.583/0.445 ms
~ $ ip addr show docker0
4: docker0@NONE: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 2e:d2:a4:d2:15:9b brd ff:ff:ff:ff:ff:ff
    inet 172.17.42.1/16 scope global docker0
       valid_lft forever preferred_lft forever
    inet6 fe80::2ca5:8aff:fe89:48a5/64 scope link 
       valid_lft forever preferred_lft forever
~ $ docker --version
Docker version 1.8.1, build d12ea79
~ $ docker info
Containers: 24
Images: 190
Storage Driver: btrfs
 Build Version: Btrfs v4.1.2
 Library Version: 101
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 4.1.4-1-ARCH
Operating System: Arch Linux
CPUs: 4
Total Memory: 7.602 GiB

Similar info for the laptop. Silly question...have you rebooted recently? I noticed that 'ip addr show' on my machines shows 'docker0@NONE', while @aborigines' just shows 'docker0'. That changed after a recent systemd update (I don't actually know why...haven't looked it up, either). Not sure if it's related or not.

I use ufw on both machines, but otherwise nothing out of the ordinary that I'm aware of. Have you tried doing something like 'curl http://checkip.dyndns.com' instead of using ping to check your connectivity?

Scott

Last edited by firecat53 (2015-08-25 03:08:13)

Offline

#5 2015-09-15 03:32:15

aborigines
Member
Registered: 2013-03-09
Posts: 4

Re: Docker container can't connect to Host's network after recent Update

hi @firecat53

this is problem systemd-network with docker


can slove with this post (offical git issue of docker)
topic https://github.com/docker/docker/pull/15007

slove topic https://gist.github.com/moxiegirl/8badac5d2a5e9d37fc07

Last edited by aborigines (2015-09-16 03:24:47)

Offline

#6 2015-09-16 03:25:35

aborigines
Member
Registered: 2013-03-09
Posts: 4

Re: Docker container can't connect to Host's network after recent Update

finaly i can find problem
https://bbs.archlinux.org/viewtopic.php?id=200000
relate to https://github.com/docker/docker/issues/15630

Upgrade from 1.7.1 to 1.8.1 incomplete bridge settings #15630

Offline

Board footer

Powered by FluxBB