1

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!

Chris
  • 515
  • 2
  • 6
  • 13

1 Answers1

0

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.

zappy
  • 1,864
  • 3
  • 18
  • 36
  • Thank you very much. This works exactly as it should! For "bonus points": How would I delete the container if not needed any more. And how can I alter the config (Adding another Port using -p)? – Chris Jul 15 '15 at 07:30
  • Run `sudo docker ps -a` to list all containers...then run `sudo docker rm -f container_name/container_id` to forcefully remove particular one.Your second question is not clear to me..sorry – zappy Jul 15 '15 at 08:30
  • Thank you! Regarding the second question: Running `docker run -t -p 9000:9000 -p 12201:12201 graylog2/allinone` the first time. I might want to forward another port later on ( -p 5555:5555). How would I do that without having to destroy the container and set it up again? – Chris Jul 15 '15 at 09:10
  • Read the first answer of [this](http://stackoverflow.com/questions/19897743/exposing-a-port-on-a-live-docker-container) thread. I think this is what you are asking for.. – zappy Jul 15 '15 at 09:23
  • The answer seems a little outdated to me. I would assume that there is an "easy option" to later add parameters. But I will research this further before asking more questions. Thank you for all you help – Chris Jul 15 '15 at 09:52