Docker promotion process

Say we want to use Docker for non-prod only, but for prod, we’ll use VM. With this approach, we build the application/software for Docker container for non-prod environments, but then when it comes to production, it’s a different software install/configuration because they are not running in a container. How would I approach this?

You could potentially use docker export to dump the contents of the container to the VM.

Will the setup/configuration inside the container be same as on the VM? In other words, if I do all sort of tests in non-prod, and these are all working for apps running in containers, now I export the contents from container to VM, will there be any surprises that things in containers but not in VM? Thanks!

If I told you, then they wouldn’t be surprises! Muahahahaha!


Yes, there will be differences and you’ll need to test, but once you understand the differences, they should be consistent because your VM is stable and the container base images are stable. Then you can then narrow your testing on future deployments to production. Your container (probably) includes a full root file system, so you could theoretically replace most of your VM’s file system with what is in the container (including the configurations), but if they’re not the same Linux distro, the number of “surprises” will be large.

Things that are typically different between a container and a full VM:

  • how the VM starts (if you do replace its root file system then you’ll probably lose init as the first process)
  • how the application starts (e.g. how will the VM start your container’s ENTRYPOINT)
  • how networking is configured
  • available volumes/disks
  • how logging is handled (stdout/stderr vs writing directly to files)

The steps to use your docker export tarball in a VM are like the reverse of creating a Docker base image: you’re extracting a root file system and then adding the init processes (or their equivalents). It won’t be easy because there isn’t a nice reverse-Debootstrap tool to work on the tarball.

I’m sorry this is so hand-wavy. I haven’t done all the steps myself – I just know it should be possible, and a lot of details depend on your Linux distro and how your software is configured. You’ll find things that are different between the VM and containers, and then you’ll need to decide where to make the adjustments: in the container, in the VM, or during the extraction process.