"docker container run --detached" - Run Container in Background
How to Create a new Container and run it in the background using the "docker container run --detach" command?
If you want to create an Alpine container and start a command that runs for a long time, you can use the --detach option to let it run in the background.
1. Create a new container with "alpine" image and start it in the background. The container is doing nothing but sleeping for 10 hours.
$ docker container run --name 3rd_alpine --detach alpine sleep 36000 a4570be81d299db8aa24fa1f677aa293410af0a0a436ec9cd0e162fc785dc215 $
2. Check the container status.
$ docker container list --latest CONTAINER ID IMAGE COMMAND CREATED STATUS NAMES a4570be81d29 alpine "sleep 36000" 8 seconds ago Up 8 seconds 3rd_alpine
As you can see, we have started a new Alpine container that runs a long execution command in the background quietly.
You can check its log message. But it will be empty.
2019-05-18, 208👍, 0💬
What Is Azure API Management Service? Azure API Management as a turnkey solution for publishing APIs...
What is Azure API Management Gateway? Azure API Management Gateway is the Azure Web server that serv...
Why Do You Need to Filter Out Empty Files in PHP? When you are processing uploaded files, you need t...
How To Upload Files into Database in PHP? To store uploaded files to MySQL database, you can use the...
How Values in Arrays Are Indexed in PHP? Values in an array are all indexed their corresponding keys...