HOME BLOG

How to keep a docker container running

Posted on: March 22nd, 2021 by Olu No Comments

Hi folks,

Just a quick tip on how to keep a docker container running. Assuming you set up a docker container and you just want to do some inspections on the container before making it run its single long-running command, you may realize that the container will exit with exit code 0 if there is no “command” flag. How then do you keep the container alive without its intended long-running command?

You can do this by using a command like:

command: tail -f /dev/null

Then once you are through with your inspection you can remove that command and add the actual desired one.

That’s all for now. Till next time, happy software development.

Source:

command: tail -f /dev/null. stackoverflow. https://stackoverflow.com/questions/44884719/exited-with-code-0-docker

Leave a Reply