Skip to content
Etienne Dublé edited this page Mar 29, 2016 · 6 revisions

Docker is a convenient tool when setting up an operating system. But, at the end of the process, sometimes we want to run this operating system on a real machine, instead of a container. With debootstick, we can achieve this easily. The idea is to export the filesystem content of a container and use it as input of debootstick.

Exporting the filesystem tree

Exporting the filesystem tree of a docker container can be done by using the docker export command.

If what we have is not a container but a docker image (ubuntu:14.04 in this example), we will have to generate a container from the image first:

$ docker create --name mycontainer ubuntu:14.04

We can now retrieve the content of this container, and then remove it.

$ mkdir mycontainer_fs 
$ cd mycontainer_fs/
$ docker export mycontainer | tar xf -
$ docker rm mycontainer   # not needed anymore

Customization

The OS embedded in official Ubuntu docker images is slightly customized. In particular, starting services is disallowed. We have to revert this:

$ chroot .
$ rm /usr/sbin/policy-rc.d
$ dpkg-divert --remove /sbin/initctl
$ exit	# from chroot

debootstick, kvm, etc.

The chroot environment is now ready to be used by debootstick, and you may follow the usual workflow, starting at step 2.

Clone this wiki locally