How to create Virtual Machines from scratch

We've created a script that will help you create Virtual Disks images and docker images. This script is named create_imagevm. You can obtain it by cloning the following git repository: https://github.com/CosyVerif/images. In order to use it, you have to download genvm, which is located on the CosyVerif's repository. Here's how to do it. You also have to install the package docker.io.

If you want to use that script you have to be root ! (or a least be able to use the sudo command).

The scripts works that way: first, it download an up-to-date debian system (you can specify which version), make a docker image out of it, and applies dockerfiles on it (you can choose which ones). You can modify the way the script behaves by using a lot of options. Here's the list of all of them:

Here are some examples of how you can use this script:

Example 1

Let's say you want to create a virtual disk image containing a jenkins slave, and you've filled the authorized_keys file correctly. Here's what you can do:
sudo ./create_imagevm -t vm -b jenkins-slave

Example 2

Let's say you want to create a custom virtual disk image with the following dockerfiles: with-kernel, with-buildeb, without-recommends. Here's what you can do:
sudo ./create_imagevm -t vm -b custom:with-kernel,with-buildeb,without-recommends
You can also do that:
sudo ./create_imagevm -t vm --custom=with-kernel,with-buildeb,without-recommends

Example 3

Let's say that you already have a docker image named foo:bar, and you want to make a virtual disk image out of it. Here's what you should do:
sudo ./create_imagevm -t vm --custom= --from=foo:bar
As you may have noticied, there are no dockerfiles specified. This is not a mistake. However, the dockerfile clean will still be applied on foo:bar.