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:
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:
Now, run the docker ps command to verify whether the container has been paused or not:
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:
After doing so, use the below-stated command to check whether the container has been changed from pause status to running status or not:
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.