• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Pause and Resume Docker Containers

by admin

Question: How to Pause and Resume running containers on docker host?

This post will help to know about pausing and resuming any running containers on the Docker host.

Let’s first start the docker container “memory_test” on the docker host.

# docker start memory_test
memory_test

To stop the pause the docker container:

# docker pause memory_test
memory_test

Verify the state of docker container using “docker ps”:

# docker ps
CONTAINER ID     IMAGE       COMMAND                  CREATED            STATUS             PORTS      NAMES
e6c2db30aa3f mytd/httpd:v2 "/bin/sh -c '/usr/sb…"  15 minutes ago   Up 11 seconds (Paused)  80/tcp   memory_test

You can also try connecting to the container. It should give you below error:

# docker exec -it memory_test bash
Error response from daemon: Container memory_test is paused, unpause the container before exec <<<< container is paused , you can not connect .

Run the below command to resume or unpause the container.

# docker unpause memory_test

Verify the state of the docker container again.

# docker ps
CONTAINER ID     IMAGE         COMMAND                CREATED       STATUS            PORTS          NAMES
e6c2db30aa3f mytd/httpd:v2 "/bin/sh -c '/usr/sb…"  17 minutes ago  Up 2 minutes      80/tcp        memory_test

Now you can connect to container again via docker exec command .

# docker exec -it memory_test bash
bash-4.1# uname -a
Linux e6c2db30aa3f 4.14.35-1818.3.3.el7uek.x86_64 #2 SMP Mon Sep 24 14:45:01 PDT 2018 x86_64 x86_64 x86_64 GNU/Linux

The container is connected and commands also work fine inside containers.

Filed Under: DevOps, Docker

Some more articles you might also be interested in …

  1. ‘docker images’ command error – “Permission Denied”
  2. Kubernetes Command Line Reference (Cheatsheet)
  3. Backtick (`) symbol in Linux Shell Scripting
  4. How to write multiple plays and per-play privilege escalation in Ansible
  5. Puppet Server’s Resources Cheat Sheet with Examples
  6. Unable to run NGINX Docker due to “13: Permission denied”
  7. How to Write Ansible Playbook and run it using the ansible-playbook command
  8. ansible-playbook: command not found
  9. How to Download Ext JS GPL
  10. Troubleshooting kubectl Error: The connection to the server x.x.x.x:6443 was refused – did you specify the right host or port?

You May Also Like

Primary Sidebar

Recent Posts

  • powertop Command Examples in Linux
  • powertop: command not found
  • powerstat: command not found
  • powerstat Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright