brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: docker pause freezes a container without stopping it

Docker
~/tips/tip-docker-pause

docker pause my-app

Suspends every process in a container in place, until you unpause it.

Stopping a container ends its processes. Pausing it holds everything where it is, which is handy when you need a busy container to be quiet for a minute.

docker pause suspends all processes in the container. On Linux it uses the cgroup freezer. The docs point out the difference with SIGSTOP: a process stopped by that signal can notice it, but a process frozen by the freezer cannot tell that it was paused or resumed.

docker pause my-app
docker ps --filter status=paused
docker unpause my-app

I would reach for it when I want a consistent copy of a data folder from a container that writes a lot, or when something is eating the CPU and I need a moment to look at the rest of the system. Nothing is killed, and the container carries on from where it was.

Time keeps moving for the outside world. Clients talking to the container will see their requests hang and may time out. I would also not count on a paused container giving back memory, so if you need the RAM, stop it instead.

Further reading: docker container pause

More Docker tips ONBUILD RUN /usr/local/bin/python-build --dir /app/src SHELL ["/bin/bash", "-c"] docker commit <container> myname/testimage:version3 docker import /path/to/exampleimage.tgz docker compose events All Docker tips (192) All topics

Link