The truth is that big part of IT population does not clearly understand what Docker is.
I recently got a question from one of my customers, if I can perform conversion of a Docker container to a full VM. “We developed an app in Container, now we want to run it on separate VM” – he told.
I tried to explain some things, and tried to understand the reasoning behind that request, but, eventually, customer is customer and if customer asks, we need to find a solution.
To be honest, I was interested myself, if such a C2V is even possible. What tools can be used to do that?
You could think “Well, it is Linux container, so why not to install SSH inside it and just convert it using VMware converter.” I tried it actually, and of course, as I was expecting it did not work. The reason is simple: “Boot disk not found”.
If you are surprised at this point, it means you do not clearly understand how Docker works.
Some theory: Docker is a Container technology, It does not run a full blown OS inside a container, it runs only the processes application needs.
In simple words:
- Docker container does not have its own disks.
- Docker container does not have boot partition with ‘Boot loader’ inside (because it never boots)
- Docker container does not even have INIT process. The PID 1 in docker container is your own application.
OK, so what should we do, if our customer demands us to convert it to a VM?
The answer is simple, try to explain to customer, that it is not possible. Propose other options. I can even suggest some.
- Nice one: Build new VM and deploy the application inside.
- Strange one: Convert the whole Docker host together with Docker container which hosts the application.
- The Extra complex one (this is theory only, I haven’t tested it):
- Build an image file with dd command
- Create partition table in image file and write an MBR on it.
- Format partitions in image file.
- Mount image file and rsync files from Docker container to the filesystem inside.
- Mount system partitions to copied partition ( /proc, /sys, /dev, etc)
- chroot into mounted image.
- download and install Kernel and Bootloader (it may be needed to compile Kernel).
- create /etc/fstab file.
- create /etc/resolv.conf
- Convert image file to .vmdk using qemu-img.
- Create VM and configure it to use the .vmdk file from previous step.
Option 3 is basically same as building new OS and copying the app. You just build OS with your own hands (reminds me of Gentoo). It is just an interesting and complex solution which worth to be mentioned.
In conclusion I want to say, Docker has its own purpose, and if your plan is to run your application in a VM, consider migration plan in advance.
Latest posts by Aram Avetisyan (see all)
- Configure Proxy settings for VSAN Health-Check Plugin(CLI) - August 11, 2016
- Replacing driver for MegaRAID SAS 9361-8i on ESXi 6 - July 12, 2016
- Remove and Re-Create Management Network (vmk0) VMkernel interface using ESXi Command line - July 6, 2016