This project provides two simple Bash scripts that allow you to safely switch between:
- Docker Desktop for Linux (which requires KVM)
- VirtualBox (which requires direct VT-x access)
On Linux, these two cannot run at the same time because they both need exclusive control of the hardware virtualization engine.
This solution allows both tools to coexist on the same system using a clean switch + reboot approach.
- Docker Desktop for Linux runs inside a lightweight VM using QEMU + KVM
- VirtualBox requires direct access to Intel VT-x / AMD-V
- Only one hypervisor can control hardware virtualization at a time
Attempting to run both simultaneously results in errors such as:
VT-x is being used by another hypervisor/dev/kvm not found
| Mode | KVM | VirtualBox | Docker Desktop |
|---|---|---|---|
| Docker Mode | Enabled | β | β |
| VirtualBox Mode | Disabled | β | β |
A reboot is required after each switch to ensure stability.
Clone the repository:
git clone https://github.com/hehealexandru/docker_virualbox_switch_scripts.git
cd docker_virualbox_switch_scriptsMove the Scripts to System Path
sudo mv use-docker use-virtualbox /usr/local/bin/Make the Scripts Executable
sudo chmod +x /usr/local/bin/use-docker
sudo chmod +x /usr/local/bin/use-virtualboxVerify Installation
which use-docker
which use-virtualboxRun which Program You want to Use
use-dockerOr
use-virtualboxThis project is currently tested on Ubuntu 22.04 / 24.04.
Future improvements will focus on extending compatibility to other Linux distributions, including:
- Fedora
- Arch Linux
- Independent OS
Distribution-specific differences (package names, systemd behavior, kernel module handling) will be addressed as part of this effort.