Run container in the background

Instead of running with docker run -i -t image your-command, using -d is recommended because you can run your container with just one command and you don’t need to detach terminal of container by hitting Ctrl + P + Q.


However your container immediately stops unless the commands are not running on foreground.

You can add tail -f /dev/null to your command. By doing this, even if your main command runs in the background, your container doesn’t stop because tail is keep running in the foreground. For example:

$ docker run -d fedora tail -f /dev/null

Popular posts from this blog

How to delete / clear queue of PowerMTA