Docker Community Forums

Share and learn in the Docker community.

Docker start network problems


(Eric Miller) #1

I filed issue 9274 on this: https://github.com/docker/docker/issues/9274. But maybe it’s just my ignorance so I’m also asking here.

I’m trying to setup docker containers as services. I want to use docker create to make named containers, then use docker start in upstart conf files to manage the services. I would like to link some of these containers to others.

In my testing I found that stopping a linked container and re-starting with docker start broke the link. Worse, docker start seems to break /etc/hosts access. My scenario is below.

Is this a bug? Am I misunderstanding how docker start works?

Scenario and environment data below.

I’m running Ubuntu 14.04 with Docker 1.3

eric@eric-u14:~/Docker$ uname -a
Linux eric-u14 3.13.0-35-generic #62-Ubuntu SMP Fri Aug 15 01:58:42 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
eric@eric-u14:~/Docker$ docker version
Client version: 1.3.1
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): 4e9bbfa
OS/Arch (client): linux/amd64
Server version: 1.3.1
Server API version: 1.15
Go version (server): go1.3.3
Git commit (server): 4e9bbfa

When I used docker start I lose access to /etc/hosts. The result is my networking is messed up. Here is a simple example:

  1. Run debian with a bash shell.
  2. cat /etc/hosts and ping <container_id> OK.
  3. Exit.
  4. docker start -a <container_id>
  5. ping <container_id> hangs
  6. cat /etc/hosts hangs or ping <container_id> hangs

Here is my shell interaction for above scenario. After ping and cat hangs I control C.

eric@eric-u14:~/Docker$ docker run -it debian bash
root@e6632c90d96d:/# cat /etc/hosts
172.17.0.43     e6632c90d96d
127.0.0.1       localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
root@e6632c90d96d:/# ping e6632c90d96d
PING e6632c90d96d (172.17.0.43): 48 data bytes
56 bytes from 172.17.0.43: icmp_seq=0 ttl=64 time=0.130 ms
56 bytes from 172.17.0.43: icmp_seq=1 ttl=64 time=0.084 ms
^C--- e6632c90d96d ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.084/0.107/0.130/0.023 ms
root@e6632c90d96d:/# exit
exit
eric@eric-u14:~/Docker$ docker start -a e6632c90d96d
e6632c90d96d
root@e6632c90d96d:/# ping e6632c90d96d
^Ceric@eric-u14:~/Docker$ docker stop e6632c90d96d
e6632c90d96d
eric@eric-u14:~/Docker$ docker start -a e6632c90d96d
e6632c90d96d
root@e6632c90d96d:/# cat /etc/hosts
^Ceric@eric-u14:~/Docker$

(Eric Miller) #2

Never mind. I’m an idiot. Using the -i “interactive” flag solves this. docker -ai start <container_id> works fine.