We will help you to understand how to pause processes in docker container. For this, we use “docker pause” command.
“docker pause” command pause processes within one or more docker container.
Command:
docker pause container_name_1 container_name_2 …
How docker pause command works ?
- docker pause command suspends all the processes of containers.
SIGSTOP
signal is used to suspend the process inside container.- Once all the processes go to suspend state, you can’t go to inside container by
exec
command. - After doing unpause the container, All the processes get resumed and there is no change in process ID.
Example:
% docker pause ubuntu
% docker ps
CONTAINER ID | IMAGE | COMMAND | CREATED | STATUS | PORTS | NAMES |
9b815c2b0d3c |
ubuntu:latest |
“bash” |
22 hours ago |
Up 22 hours (Paused) |
ubuntu |
Now, we will check the processes of container.
% docker top ubuntu
UID | PID | PPID | C | STIME | TTY | TIME | CMD |
root | 2818 | 2792 | 0 | Aug12 | ? | 00:00:00 | bash |
root | 3323 | 2859 | 0 | 03:26 | ? | 00:00:00 | python3 -m http.server |
root | 3422 | 2792 | 0 | 14:57 | ? | 00:00:00 | bash |
root | 4353 | 2792 | 0 | 18:05 | ? | 00:00:00 | bash |
Read about unpause the process of container
To learn more about docker, Please refer given below link:
https://techieindoor.com/
References:
https://en.wikipedia.org/wiki/Docker_(software)