Menu Close

Docker – Pause processes in docker container

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 IDIMAGECOMMANDCREATEDSTATUSPORTSNAMES

9b815c2b0d3c

ubuntu:latest

“bash”

22 hours ago

Up 22 hours (Paused)

ubuntu

Now, we will check the processes of container.

% docker top ubuntu
UIDPIDPPIDCSTIMETTYTIMECMD
root281827920Aug12?00:00:00bash
root33232859003:26?00:00:00python3 -m http.server
root34222792014:57?00:00:00bash
root43532792018:05?00:00:00bash

 

Read about unpause the process of container

To learn more about docker, Please refer given below link:

https://www.techieindoor.com/

References:

https://en.wikipedia.org/wiki/Docker_(software)

Posted in docker

Leave a Reply

Your email address will not be published.

Contact Us