简体   繁体   中英

Docker container not starting a second time (iptables)

Using this guide http://docs.graylog.org/en/1.1/pages/installation/docker.html I set up an Docker container on my Ubuntu 14.04 server.

Starting the container the first time using the command wors as expected.

docker run -t -p 9000:9000 -p 12201:12201 graylog2/allinone

I than am able to open the web interface exposed on port 9000.

When I stop the Container and try to run it again with the same command I get this error:

Error response from daemon: Cannot start container  c5cc5831fe854801345ffa2370fdb4f00f4182e209fe1af78233c93be3952bb1:
iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 12201 -j 
DNAT --to-destination 172.17.0.9:12201 ! -i docker0: iptables: No chain/target/match by that name.
(exit status 1)

Starting the container with out any -p parameter leads to a running container. But the ports seem not to be exposed. I'm not able to access the web interface. The output of "docker ps" looks then like this:

84d322d35d58        graylog2/allinone   "/opt/graylog/embedd   9 minutes ago       Up 9 minutes        
443/tcp, 514/tcp, 4001/tcp, 9000/tcp, 514/udp, 
12201/tcp, 12900/tcp, 12201/udp   focused_elion  

For me it looks like the ports are exposed. But the host machine is not forwarding the requests to the Docker Container.

After removing the container and reinstalling Docker and than installing the Container again it is working again on the first start. But fails on the second time.

Any tips or pointers are welcome!

Hope the following paragraph from docs.docker.com can help you.Worked for me ...

Oops! Just after you stopped the container you get a call to say another developer needs the container back. From here you have two choices: you can create a new container or restart the old one. Let's look at starting our previous container back up.

 $ docker start nostalgic_morse nostalgic_morse 

Now quickly run docker ps -l again to see the running container is back up or browse to the container's URL to see if the application responds.

Note: Also available is the docker restart command that runs a stop and then start on the container.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM