Skip to content

Migrate docker container to a VM

Christian Hueller edited this page Jul 29, 2016 · 2 revisions

Issue related to this topic:

https://github.com/SUSE/machinery/issues/1922
https://github.com/SUSE/machinery/issues/1923

Inspect the container

machinery inspect-container --extract-files --name opensuse_docker opensuse

Export the inspected data as autoyast config

./bin/machinery export-autoyast --autoyast-dir /tmp/opensuse_container opensuse_docker

Get required commands and boot options from the README in the exported data

cd /tmp/opensuse_container/opensuse_docker-autoyast
less README.md

E.g.

  • Command to serve autoyast file:
cd /tmp/opensuse_container/opensuse_docker-autoyast; python -m SimpleHTTPServer
  • Boot options to be provided to installation:
autoyast2=http://10.160.4.45:8000/autoinst.xml

Start installation using virt-manager

  • Serve the autoyast config using the command provided in the README.md
  • Start virt-manager
  • Click on File->New Virtual Machine
  • Choose installation media source, e.g. local install media
  • Click Forward
  • Provide path/url to install media
  • Expand URL options
  • Enter Autoyast URL as provided in the README.md without the autoyast2= prefix
  • Click Forward
  • Choose Ram and CPU count
  • Click Forward
  • Choose Virtual disk size
  • Click Forward
  • Enter a name for the VM
  • Click Finish

The installation is now starting and runs automatically using the autoyast config

Compare newly created VM with original docker image

After the installation has finished you can inspect the newly created VM using machinery with

machinery inspect --extract-files --name opensuse_vm $IP_of_vm

you have to make sure that sshd is running though as in the docker container it is not enabled and thus machinery would not enable it in the created VM as well. Also many docker containers lack rsync which also is required by machinery, so install that as well.

Now compare the docker description with the VM description:

./bin/machinery compare opensuse_docker opensuse_vm

To see the differences in a browser, use

./bin/machinery compare opensuse_docker opensuse_vm --html

and enter the provided url in your browser.