Docker

How to Pause and Unpause Docker Containers

Docker is a software forum that allows users to generate, test, and deploy applications efficiently. It also allows developers to separate applications from their infrastructure and as a result, they can deliver applications quickly. Docker also helps developers to manage their infrastructure in the same manner they manage their applications.

The outcomes from this guide are:

What is a Docker Container?

Docker packages applications into standardized units known as containers that contain all the required instructions that are essential for executing the app including libraries, code, system tools, and runtime. Additionally, containers are defined by the images as well as any configuration options that developers provide to them when they create or start it. Developers can create, pause, unpause, move, or remove containers whenever they want by using the Docker CLI or API.

How to Pause Docker Containers?

Sometimes, users want to suspend the running containers for different reasons, such as they don’t need the services anymore. To do so, first, they need to get the particular container name by running the provided command:

docker ps

From the below-given output, we have selected the cocoa_con1 container to pause its services:

Then, execute the docker pause command along with the previously selected container name:

docker pause cocoa_con1

Now, run the docker ps command to verify whether the container has been paused or not:

docker ps

As you can see, the current status of the particular container has been changed to the pause:

How to Unpause Docker Containers?

If you want to unpause and utilize the services of the container, simply execute the docker unpause command along with the container name:

docker unpause cocoa_con1

After doing so, use the below-stated command to check whether the container has been changed from pause status to running status or not:

docker ps

That’s it! We have provided the easiest method to pause and unpause Docker containers.

Conclusion

In Docker, containers are used to dockerize any software or application including everything that is needed to execute them. Moreover, developers can suspend by executing the docker pause <container-name> command or unsuspend the container services with the help of the docker unpause <container-name> command. This article illustrated the method for suspending and unsuspending Docker containers.

About the author

Maria Naz

I hold a master's degree in computer science. I am passionate about my work, exploring new technologies, learning programming languages, and I love to share my knowledge with the world.