Can I suspend and then resume a Docker container?
As of Version 0.12.0, Docker supports PAUSE
and UNPAUSE
commands to pause and resume containers using cgroup freezer.
The commands:
$ docker pause <containerName>
$ docker unpause <containerName>
Here's a demo of them in action:
AFAIK right now it can't be done with pure docker but lxc supports that. I've play around little bit with docker and confirmed that this can be done with
lxc-freeze -n <containtr.id>
and to resume operations
lxc-unfreeze -n <container.id>
But in v0.2.0 docker ps gives you only shorten containter id even with -notrunc and lxc-ls output is empty on my system (strange, need to read more about it, as docker uses plain lxc-start with params so lxc-ps should print this). I found full container id with lxc-ps
. It would be nice to add docker freeze command. Maybe it's time for me to learn some go :)
Here's a recent deck on the recent experimental integration of Checkpoint/Restore In Userspace (CRIU) + Docker.