September 13, 2016

Suspend/Resume problems Docker containers

Docker resume/thaw problems?

When you use Docker containers on your development system and experience problems after a resume from a suspend (or a thaw from a hibernate). On my Debian Stable KDE system –after a resume of my MongoDB and WildFly containers– the screensaver did not ask for a password and the computer did not respond to mouse and keyboard.

Fix via pm-utils script

A pm-utils script can be added to pause all running Docker containers on suspend /hibernate and unpause them on resume/thaw. Create a fileĀ /usr/lib/pm-utils/sleep.d/00docker with following content:

command_exists docker || exit $NA
# Pause all running docker containers on suspend|hibernate and unpause on resume|thaw.
case $1 in
    suspend|hibernate) docker pause $(docker ps -q) ;;
    resume|thaw)       docker unpause $(docker ps -q) ;;
    *) exit $NA ;;
exit 0
Tags: Software Shell Script Computer KDE Linux Docker GUI