How to Install Docker on a Virtual Machine in Proxmox
If you’re running a homelab with Proxmox, you might be wondering whether to install Docker directly on the Proxmox host or inside a virtual machine (VM). While Proxmox supports LXC containers, many users still prefer the flexibility and isolation that a Docker VM offers.
In this guide, I’ll walk you through setting up a VM in Proxmox and installing Docker on it
Why Use Docker in a VM Instead of Proxmox Host?
- Better isolation: Separate environments for experimentation or production.
- Easier backups: Snapshot the entire VM with Proxmox.
- Avoids breaking Proxmox host: Updates or changes to Docker won’t affect the hypervisor.
- Flexible networking: You can assign custom bridges, VLANs, or virtual NICs.
Create a Virtual Machine in Proxmox
- Login to Proxmox Web UI
- Go to Datacenter > Your Node > Create VM
- Fill out the general settings:
- VM ID & Name: Example:
docker-vm
- ISO Image: Choose an ISO with a lightweight OS like Ubuntu Server, Debian, or AlmaLinux
- VM ID & Name: Example:
- System:
- BIOS: Default (OVMF for UEFI optional)
- Machine:
q35
ori440fx
- Disks:
- Use VirtIO or SCSI
- Size: 20–50GB depending on your use
- CPU & Memory:
- CPU: 2 cores
- RAM: 2–4 GB minimum
- Network:
- Model: VirtIO (paravirtualized)
- Bridge:
vmbr0
(or your preferred network)
Install the OS
- Open the console of the VM.
- Complete installation of your chosen Linux distribution.
- Update the system:
sudo apt update && sudo apt upgrade -y
Install Docker (Ubuntu/Debian)
You can use Docker’s official installation script:
curl -fsSL https://get.docker.com | sudo sh
Alternatively, manual steps:
sudo apt install -y ca-certificates curl gnupg lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) \
signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io
Optional: Add your user to the docker group:
sudo usermod -aG docker $USER
Install Docker Compose
sudo apt install -y docker-compose
Conclusion
Installing Docker inside a Proxmox VM is a safe and flexible way to run containers in your homelab. You benefit from the power of Proxmox for snapshots, backups, and resource control, while still taking full advantage of Docker’s container ecosystem.