Run any OS previously installed in a qcow2 virtual disk file, inside a docker image.
998
This image is intended as a means for running virtual machines created elsewhere, such as using my any-vm-creator docker image. Though, it will run any VM image that is in .qcow2 format and mounted into the container as described below. This means that it will boot any VM that you give it in qcow2 format, regardless of the Operating Stystem installed therein. (e.g. a full windows virtual PC in a docker container, or an instance of Android_x86, whatever floats yur boat really...)
Start the conatiner with the following, or something similar:
docker run -d --privileged \
--name any-vm-runner \
--cgroupns host \
--device=/dev/kvm \
--device=/dev/net/tun \
-e MEMORY=4096 \
-e CPU=4 \
-e OS_VARIANT=windows11 \
-v /sys/fs/cgroup:/sys/fs/cgroup:rw \
-v any-vm-creator:/guestVMdata \
-v scripts:/scripts \
-p 0.0.0.0:5910:5910/tcp \
-p 0.0.0.0:3389:3389/tcp \
--cap-add=NET_ADMIN \
--cap-add=SYS_ADMIN \
gregewing/any-vm-runner:latest
When the container starts for the first time, it will look for a virtual disk image file mounted at /guestVMdata/guestVM.qcow2. If it finds one then it will attempt to boot the OS installed in that virtual disk file.
You may have to specify a few things to get your image to boot, such as the BIOS Type and the guest VM OS type, see Environment Variables below.
I assume you understand enough about port mappings in docker to set this up how you need it without me having to tell you how to do it. Map the ports you need based on your requirements.
There are a couple of key volume or bind-mount used by this container image:
-v any-vm-creator:/guestVMdata replace -v any-vm-creator with the name of a volume that you created beforehand. This is a very important step, as this is where the guest VM .qcow2 disk needs to be stored, so teh container can boot it.-v scripts:/scripts (optional) this mount, if you chose to use it enables you to run scripts inside the docker container immediately after it is started. The container will execute any .sh scripts it finds in /scripts before starting the nested VM. Use this to make any customisations that you require to the container or its nested VM, perhaps by waiting for the VM to boot and then interacting with it. (for example, applying firewall rules, routing configurations or customising the guestVM) If no scrits mount is provided, then this will be ignored.The above docker run command makes use of the following environment variables, which you may want to alter to suit your requirements:
Yes using Legacy BIOS, and specifically no virtio-win.iso cd mounted.
I have created a github repository for this project, please raise any comments, suggestions or issues there.
Content type
Image
Digest
sha256:383b6ec54…
Size
308.5 MB
Last updated
13 days ago
docker pull gregewing/any-vm-runner