Apologies if this question has been answered elsewhere but I can't see it.

I would like to set up two VMs on a RP 4 to help in a piece of research I am doing. Is there a tool that can do this? I don't need the VMs to do very much except generate some network traffic and conduct some logging so I am not expecting the computing power to be much. I would conventionally use KVM/QEMU on my other Linux machine but have worked out so far this isn't an option on Raspberry Pi architecture.

Many thanks


  • What os are you going to use? Is the OS chrooted? Jun 24, 2020 at 14:34

3 Answers 3


If you do not want to use hardware virtualization features, your best chance to use containers like Docker or LXC as goldilocks said.

When I read your question, my first think was Docker because I used it earlier. After I see goldilocks's answer and I see LXC ...

I'm not try it yet, but it is possible its better chance in your situation. https://linuxcontainers.org/lxc/introduction

"LXC containers are often considered as something in the middle between a chroot and a full fledged virtual machine. The goal of LXC is to create an environment as close as possible to a standard Linux installation but without the need for a separate kernel."

There is a little blog about the differences beetwen LXC and Docker: https://pasztor.at/blog/lxc-vs-docker

"Common misconception: Docker does not use LXC. In the beginning Docker used the LXC command line tools to run containers, but that is no longer the case. Both Docker and LXC use the containerization features in the Linux kernel, but are independent of each other. "

  • Thanks for the correction re: the relationship between LXC and docker. Note that linux is (likely) moving toward a substitute implementation of docker called podman (it has the same user interface such that podman can be aliased as docker) but it has not been adopted by Debain & therefore not Raspbian/RPiOS. I mention this because if you see reference to it somewhere you can just ignore it for now.
    – goldilocks
    Jun 25, 2020 at 13:33

I've spent nearly a year perfecting a command-line tool for RPi called vdesktop.
It does exactly what you want - boot a RaspiOS image in a virtual container. As opposed to manual methods like chroot and systemd-nspawn, Vdesktop is the only tool that displays the container's entire graphical desktop.
Other unique features include sound syncing, clipboard syncing, and the ability to boot from attached SD Cards and .img files.

Here's my vdesktop repository: https://github.com/Botspot/vdesktop
And below is a GIF showing the entire boot process: animated


generate some network traffic and conduct some logging

That doesn't sound like something you need a heavy weight VM like QEMU for. You don't need to emulate a different hardware platform, right? And the OS is going to be some linux flavour (methinks you don't have much of a choice there).

This is what containers are for, aka operating system (as opposed to "machine") virtualization. Look into LXC or docker, both of which use containerization implemented in the kernel; what you get is an independent OS userspace (ie., all the running software except the kernel):


You could also chroot, which is simpler but more constrained. Containers evolved from chroot.

  • goldilocks, can I deploy an OS in the container with a different IP address to the host?
    – A Bingham
    Jun 27, 2020 at 7:22
  • By default, it has its own IP on an internal virtual network and transparent forwarding for client processes (ie., you can connect to the internet from inside), but they will have the same IP as the host. The norm is to then use port forwarding for server processes. That's what I've always done, but you can also use a dedicated external IP with a virtual bridge. When you are researching this stuff, search for "linux docker external IP", NOT "raspberry pi docker ...". The brand of hardware doesn't matter and the former is a much bigger and deeper community.
    – goldilocks
    Jun 27, 2020 at 13:34
  • There are tons and tons of documentation, tutorials, books, etc. I would setup a container taking the path of least resistance (eg., default network topography using port forwarding) for your first foray to get familiar with the basics.
    – goldilocks
    Jun 27, 2020 at 13:34
  • 1
    goldilocks - apologies for taking so long getting back to you. Good answer. Containers deployed on the LAN and all working!!! Thank you for introducing me to the amzing world of containers!!!!
    – A Bingham
    Jul 12, 2020 at 9:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.