Error response from daemon: Container ... is paused, unpause the container before
exec means someone ran docker pause on the container. Run
docker unpause <name>, then the same docker exec works.
The message gives the fix itself. Before you unpause, find out who paused the container: a pause is a command someone ran, not something the test saw Docker do on its own.
The error
docker run -d --name fix12-dkrun-alp alpine sleep 600
f00c4eeb23ad73457d55483825f08b1f884cbedb500b3352d4842971be734d01
docker pause fix12-dkrun-alp
fix12-dkrun-alp
docker exec fix12-dkrun-alp sh -c "echo hi"
Error response from daemon: Container fix12-dkrun-alp is paused, unpause the container before exec
docker exec exited with code 1 and printed no hi, so the
command inside did not run. In that first script the test then ran docker
unpause, which printed the container name and exited 0.
Why it happens
The container is paused, and the message says exec needs it unpaused first.
A paused container is not stopped: docker ps still lists it as up, with
(Paused) at the end of the status, which is easy to miss at a glance. Both of
these show the state plainly:
docker inspect -f "{{.State.Status}} {{.State.Paused}}" fix12-dkrun-alp
paused true
docker ps --filter name=fix12-dkrun-alp --format "{{.Names}} {{.Status}}"
fix12-dkrun-alp Up Less than a second (Paused)
The first prints the state and the paused flag, the second the name and the status, with
(Paused) at the end. Either one, run before exec, tells you
whether the unpause step is needed.
The fix
docker unpause fix12-dkrun-alp
fix12-dkrun-alp
docker exec fix12-dkrun-alp sh -c "echo hi"
hi
docker inspect -f "{{.State.Status}}" fix12-dkrun-alp
running
After docker unpause the container is running again and
exec ran the command. If a script or tool paused it, ask that tool first, so
you do not undo a pause someone needs. The test container ran sleep 600, so
pausing and unpausing it changed nothing that mattered.
How it was reproduced
Docker Desktop 4.99.0 on Windows 11, client and engine 29.9.3, runc 1.5.2, the cached
alpine:latest image (Alpine 3.24.2). A PowerShell script ran each command
through cmd /c with stderr merged into stdout, so the commands are shown
without a prompt. The container was started detached with sleep 600 and
paused in two script runs: in the first, exec gave the error; in the second,
docker inspect and docker ps showed the paused state and, after
the unpause, the command printed hi. The container name
fix12-dkrun-alp is the test's own.
Frequently asked
- How do I know if a Docker container is paused?
- docker ps shows Up with (Paused) at the end of the status. In the test docker inspect -f "{{.State.Status}} {{.State.Paused}}" printed paused true.
- How do I unpause a Docker container?
- Run docker unpause <name>. In the test the container went back to running and docker exec worked straight after.
- Can I docker exec into a paused container?
- Not in the test. The engine refused with Container ... is paused, unpause the container before exec, and the command inside did not run.
More decoded errors in the Fixes category. For
docker exec on a stopped container, see
container
is not running.