Docker Community Forums

Share and learn in the Docker community.

Force docker containers to run forever


(Drm509) #1

Is there a way to force docker containers to not close after an application is run? I’d like to find a way to block other users from crashing or closing the containers.


(Andy Rothfusz) #2

The Docker container will exit when the root process exits. You can prevent the container from exiting this way by running a process that doesn’t exit, for example, supervisord.

I’m not sure what you mean by “other users … crashing or closing the containers.” If your containers are crashing then that’s probably a software problem you need to fix inside the container. If users are closing your containers, that’s probably because they are root on the machine, so they can do anything they want – there is no way to stop root from killing a process.