This error occurs when attempting to pause a Docker container that is not in the running state. You can only pause containers that are actively running - check the container status and start it first if needed.
This error occurs when you try to use the `docker pause` command on a container that is not currently running. The full error message reads: "Error response from daemon: Cannot pause container: Container is not running". The `docker pause` command uses the Linux cgroups freezer to suspend all processes inside a container. Since this mechanism freezes running processes in memory, it requires the container to actually be running. You cannot pause a container that is stopped, exited, or in any other non-running state. This is different from the `docker stop` command, which can be run on a running container to stop it. The pause operation specifically requires an active, running container with processes that can be frozen.
First, verify the current state of your container:
docker ps -aLook for your container in the output. The STATUS column tells you the container's state:
CONTAINER ID IMAGE STATUS NAMES
abc123def456 nginx Exited (0) 5 minutes ago my_container
def456ghi789 redis Up 10 minutes my_redisA container showing "Exited" or "Created" cannot be paused - only containers showing "Up" can be paused.
You can also check a specific container:
docker inspect <container_name_or_id> --format='{{.State.Status}}'This returns the status: running, exited, created, paused, etc.
If the container is stopped or exited, you need to start it before you can pause it:
docker start <container_name_or_id>Verify it's running:
docker psThe container should now show "Up" in the STATUS column.
Once the container is running, you can pause it:
docker pause <container_name_or_id>If successful, the command completes silently. Verify the pause worked:
docker psThe status should now show "Up X minutes (Paused)".
For Docker Compose:
# Start services first if not running
docker compose up -d
# Then pause
docker compose pause <service_name>If your container keeps exiting and won't stay running, you need to fix the underlying issue before you can pause it:
# Check container logs for errors
docker logs <container_name_or_id>
# Check exit code
docker inspect <container_name_or_id> --format='{{.State.ExitCode}}'Common reasons containers exit immediately:
- The main process completes (container has nothing to do)
- The process crashes due to missing dependencies or configuration
- Missing environment variables or volumes
For containers that need to stay running for pause to work, ensure the main process doesn't exit. For example, use tail -f /dev/null as a command to keep a container alive if needed for testing.
Understanding container states: Docker containers can be in several states, and only the "running" state allows pausing:
| State | Can Pause? | Description |
|-------|------------|-------------|
| created | No | Container created but never started |
| running | Yes | Container is active with processes |
| paused | No | Already paused |
| restarting | No | Container is restarting |
| exited | No | Container stopped (cleanly or with error) |
| dead | No | Container failed to stop properly |
Pause vs Stop decision tree:
- Use pause when you want to temporarily freeze a container and resume it quickly with all state preserved
- Use stop when you want to shut down the container and don't need to preserve in-memory state
Scripting considerations: When writing scripts that need to pause containers, always check the container state first:
# Check if container is running before pausing
if [ "$(docker inspect -f '{{.State.Running}}' my_container 2>/dev/null)" = "true" ]; then
docker pause my_container
else
echo "Container is not running, cannot pause"
fiDocker Compose behavior: The docker compose pause command only affects running services. Services that are not started will be silently skipped - no error is thrown, but they won't be paused either.
Alternative: Use stop instead: If you're trying to pause a container just to free up resources and don't need to preserve state, consider using docker stop instead, which works on running containers and doesn't require the container to be in a specific state beforehand.
dockerfile parse error line 5: unknown instruction: RRUN
How to fix 'unknown instruction' Dockerfile parse error in Docker
Error response from daemon: manifest for nginx:nonexistent not found: manifest unknown: manifest unknown
How to fix 'manifest for image:tag not found' in Docker
Error response from daemon: invalid reference format: repository name must be lowercase
How to fix 'repository name must be lowercase' in Docker
Error response from daemon: No such image
How to fix 'No such image' in Docker
Error response from daemon: Container is not running
How to fix 'Container is not running' when using docker exec