Previously, I gave a quick example of running a Ubuntu/Kali virtual machine, accessible easily in a web browser using Kasm. If you missed it, check it out here.

One of the biggest frustrations in recent years when it comes to virtual machines was the move from x86/AMD to ARM for Apple devices. However, a neat trick in Docker is that we can have it emulate a platform. Couple this with the Kasm VNC running Kali/Ubuntu, and we can actually spin up a quick web-based VM, and we can also choose whether we want it to be ARM-based or x86/AMD-based. This becomes really useful where some containers/apps will only run on x86 variants.

Here are the one-liners that we need to fire up our Kasm instances quickly, supporting root and architectures as needed. We can use the command lscpu to then confirm that the VMs are running on the expected architecture.

Thanks to this message board where they discussed running x86 Docker containers on Mac!

Ubuntu (ARM)

sudo docker run --rm -it --user root --platform linux/arm64 --shm-size=512m -p 6901:6901 -e VNC_PW=password kasmweb/ubuntu-jammy-desktop-vpn:1.17.0

Ubuntu (x86/AMD)

sudo docker run --rm -it --user root --platform linux/amd64 --shm-size=512m -p 6901:6901 -e VNC_PW=password kasmweb/ubuntu-jammy-desktop-vpn:1.17.0

Kali (ARM)

sudo docker run --rm -it --user root --platform linux/arm64 --shm-size=512m -p 6905:6901 -e VNC_PW=password kasmweb/kali-rolling-desktop:1.17.0

Kali (x86/AMD)

sudo docker run --rm -it --user root --platform linux/amd64 --shm-size=512m -p 6905:6901 -e VNC_PW=password kasmweb/kali-rolling-desktop:1.17.0

One more tweak…

The above examples create a Docker container and then remove this when the container is terminated (since we are passing --rm).

Depending on how you want to use the VMs, we may want to remove this for a persistant VM environment. In which case, we may also want to give our container a name so that we can refer to it easily and restart it where we left off.

sudo docker run --name mykali -it --user root --platform linux/amd64 --shm-size=512m -p 6905:6901 -e VNC_PW=password kasmweb/kali-rolling-desktop:1.17.0
sudo docker run --name myubuntu -it --user root --platform linux/amd64 --shm-size=512m -p 6901:6901 -e VNC_PW=password kasmweb/ubuntu-jammy-desktop-vpn:1.17.0

We can use the VM as expected, and terminate the container when we are ready. When we want to then use the VM again we simply start the container again.

sudo docker start mykali
sudo docker start myubuntu