Tools, FAQ, Tutorials:
"docker container exec" - Execute Command on Running Container
How to Execute an extra Command on a Running Container using the "docker container exec" command?
✍: FYIcenter.com
Since Linux system is a multi-tasking system, you can send an extra command
to be executed on a running Alpine container.
1. Check the container status to make it is still running.
fyicenter$ docker container list --latest CONTAINER ID IMAGE COMMAND CREATED STATUS NAMES a4570be81d29 alpine "sleep 36000" 8 minutes ago Up 8 minutes 3rd_alpine
2. Send another command to be executed on the container.
fyicenter$ docker container exec 3rd_alpine ps -ef
PID USER TIME COMMAND
1 root 0:00 sleep 36000
6 root 0:00 ps -ef
As you can see, the second command, "ps -ef", was executed correctly on the container. The output tells us that the Alpine container is not busy at all. Only 2 processes are running in there!
⇒ "docker container exec --tty --interactive" - Attach to Container
⇐ "docker container run --detached" - Run Container in Background
2019-02-17, ∼1330🔥, 0💬
Popular Posts:
How to Instantiate Chaincode on BYFN Channel? You can follow this tutorial to Instantiate Chaincode ...
How to use the built-in "context" object in Policy expressions? The built-in "context" object can be...
How to pull NVIDIA CUDA Docker Image with the "docker image pull nvidia/cuda" command? If you are ru...
Where to find EPUB Sample Files? Here is a list of EPUB sample files collected by FYIcenter.com team...
Where to find EPUB Sample Files? Here is a list of EPUB sample files collected by FYIcenter.com team...