How To Keep a Docker Container Running and Not Exiting

In this blog post, we will discuss a few tips on keeping a docker container running and not exiting.

Docker containers are great for developers because they can run an application in a specific environment without installing the software locally.

There is one issue that can arise when using Docker containers: they exit after being idle for too long! In this article, I’ll show you how to prevent your docker container from exiting with some simple methods.

Keep Running

To keep your containers running and exiting, I have two options for you to use that will not let the container go ideal and exit. Use either of the two (We like to use the second option).

 docker run --name deploy2 -d ubuntu sleep infinity
 docker run --name deploy1 -d ubuntu tail -f /dev/null


Posted

in

by