0

I love docker and especially for complex CI environments it is just amazing. The one thing that I really miss when working with Docker compared to a Virtual Machine is the ability to save and restore snapshots of the container and I was wondering if Docker offers anything similar?

rok
  • 9,403
  • 17
  • 70
  • 126
doberkofler
  • 9,511
  • 18
  • 74
  • 126
  • This is possible in virtual machines because they control emulated "hardware" and can control and playback that hardware's state. There's no hardware emulation at all in containerization, so you have the exact same amount of ability to snapshot processes you'd have with normal, non-containerized programs... which is to say that the only capabilities you get are very limited, experimental, prone to breaking if you do anything remotely unusual, and unlikely to become *less* limited or experimental any time soon. – Charles Duffy Oct 16 '19 at 16:01
  • (On that last point, I've been watching people try to return to the old days where processes could be serialized to "dropfiles" when not actively running for decades, and I've yet to see it done well. By "decades" -- I had a CS professor in the late 90s who bemoaned that UNIX and paged memory won out over a competing system he'd built back in the 60s that was designed with purely serializable processes). – Charles Duffy Oct 16 '19 at 16:03
  • I kind of understand the problem of serializing the hardware's state but would this not also be the case when using the docker `commit` command? – doberkofler Oct 16 '19 at 16:05
  • Commit is just a `sync`-to-disk, maybe with some SIGSTOPs to keep things from changing in-flight. There's no in-flight memory/hardware/network state involved; it's a much easier problem. – Charles Duffy Oct 16 '19 at 16:06
  • (That said, I've graduated from Docker kool-aid to Nix kool-aid; instead of trying to serialize state, Doing It Right in the Nix world is having almost no mutable state at all -- composing a system, up-to-and-including your whole OS configuration, of reproducible steps run in isolated sandboxes with no access to anything except their stated inputs, addressed either by fixed content hashes or a tree of hashes of build steps run on hash-addressed contents). – Charles Duffy Oct 16 '19 at 16:09
  • At least for my use cases `commit` does what I need and what I would be looking for is some management of named commit states. Could `checkpoint` not just do the same as `commit`? – doberkofler Oct 16 '19 at 16:11
  • *shrug*. If you just need filesystem-level (or block-level) disk- or filesystem-level snapshots, that's been available for Linux (without any kind of virtualization involved) long before Docker existed, so yes, of course it can be accomplished on top of Docker as well. To what extent it's available out-of-the-box as an instrumented part of Docker without custom tooling is something I'll let folks who've worked with Docker more recently than I have speak to. – Charles Duffy Oct 16 '19 at 16:15

1 Answers1

1

docker checkpoint may answer your needs. Note that checkpoints is experimental feature and you may need to rerun your docker engine in experimental mode.

rok
  • 9,403
  • 17
  • 70
  • 126