M BUZZ CRAZE NEWS
// news

Docker: Keep a container from starting automatically

By Jessica Wood

I made a simple typo when adding a container in Ubuntu 15.10 using docker's run command (docker run --restart=always) now the container boots twice and listens on two different ports. My question is, how remove the unwanted instance from starting automatically.

Here is an example of what i am talking about.

PORTS NAMES
0.0.0.0:22000->22/tcp prickly_colden
0.0.0.0:2200->22/tcp grave_meninsky

Thanks to anyone who can help,

Mike

1 Answer

After some research, I was able to figure it out...

First, Inspect the restart policy of the container (optional) by typing

docker inspect --format '{{ .HostConfig.RestartPolicy.Name }}' 'your container name'

Second, remove the mistaken container instance by running this command...

docker rm -f 'your container name'

Third, restart the container with a different policy if needed...

docker run -d -p 80:80 -p 443:443 --restart=on-failure:10 'Your Image Name'

Fourth, reboot and the container should be gone!

Mike

More Information:

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy