docker run --rm -t -i phusion/baseimage:0.9.11 /bin/bash
  1. I use the baseimage-docker distro from phusion…its quite nice…includes bash, runit, and a few other nice features that make it feel like a full featured install that will work properly with docker (i.e. docker stop works correctly)

  2. The “*–rm*” will remove the container after you leave it. This is generally preferred.

  3. We just launch bash in this example. You could make your own image and launch it with zsh or the like:)

Now lets say you made some changes or installed some stuff and want to save the container for later…docker export should be able to help you:

docker export <containerid> > working.tar

And of course, don’t forget to gzip it (these actually gzip fairly well):

gzip --best working.tar

You can later import it like so:

cat working.tar > sudo docker import - working-image:lastest

Note the difference between a save and export (no history of layers with export)

Mario Loria is a builder of diverse infrastructure with modern workloads on both bare-metal and cloud platforms. He's traversed roles in system administration, network engineering, and DevOps. You can learn more about him here.