Hello!
I recently observed a problem while running a docker container on a Debian host in VirtualBox:
After starting and stopping a container several times no network connection is possible anymore. I had to restart docker service to get back online.
Docker Version installed:
$ docker -v
Docker version 18.09.6, build 481bc77
The problem is reproduceable with the lightweight busybox image. For instance running the container and killing it after a few seconds, network is still there:
$ docker run -it --rm busybox ping -c 10 8.8.4.4
PING 8.8.4.4 (8.8.4.4) 56(84) bytes of data.
64 bytes from 8.8.4.4: icmp_seq=1 ttl=53 time=20.2 ms
64 bytes from 8.8.4.4: icmp_seq=2 ttl=53 time=19.5 ms
^C
--- 8.8.4.4 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 3ms
rtt min/avg/max/mdev = 19.516/19.852/20.188/0.336 ms
I ran this sequence of start and abort (or “docker kill …”) several times (2…6 tries) and suddenly I received no answer:
$ docker run -it --rm busybox ping -c 10 8.8.4.4
PING 8.8.4.4 (8.8.4.4): 56 data bytes
--- 8.8.4.4 ping statistics ---
10 packets transmitted, 0 packets received, 100% packet loss
On the contrary running “ping …” in the debian host always(!!!) works fine, no problems:
$ ping -c 10 8.8.4.4
PING 8.8.4.4 (8.8.4.4) 56(84) bytes of data.
64 bytes from 8.8.4.4: icmp_seq=1 ttl=53 time=55.6 ms
64 bytes from 8.8.4.4: icmp_seq=2 ttl=53 time=63.5 ms
...
64 bytes from 8.8.4.4: icmp_seq=10 ttl=53 time=20.3 ms
--- 8.8.4.4 ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 39ms
rtt min/avg/max/mdev = 19.374/31.042/63.483/17.131 ms
To fix the problem, I need to restart docker service:
$ sudo service docker restart
After that, network in busybox container works properly again. Until I start the sequence above…
Does anybody know what I need to check? I’d like to have a stable network connection even if I kill a container and start it again.
Thanks in advance.