简体   繁体   English

Docker容器第二次不启动(iptables)

[英]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. 使用本指南http://docs.graylog.org/en/1.1/pages/installation/docker.html我在Ubuntu 14.04服务器上设置了Docker容器。

Starting the container the first time using the command wors as expected. 第一次使用命令启动容器时,wors符合预期。

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

I than am able to open the web interface exposed on port 9000. 我将能够打开暴露在端口9000上的Web界面。

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. 不带任何-p参数启动容器会导致容器正在运行。 But the ports seem not to be exposed. 但是端口似乎没有暴露。 I'm not able to access the web interface. 我无法访问Web界面。 The output of "docker ps" looks then like this: 然后,“ docker ps”的输出如下所示:

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. 但是主机不会将请求转发到Docker容器。

After removing the container and reinstalling Docker and than installing the Container again it is working again on the first start. 删除容器并重新安装Docker之后,再重新安装容器后,它将在第一次启动时再次工作。 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 ... 希望docs.docker.com的以下段落能对您有所帮助。

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. 现在再次快速运行docker ps -l以查看正在运行的容器是否已备份,或者浏览到容器的URL以查看应用程序是否响应。

Note: Also available is the docker restart command that runs a stop and then start on the container. 注意:也可以使用docker restart命令,该命令运行停止然后在容器上启动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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