This tutorial will focus on how to set up Docker on Proxmox using a virtual machine. While you can run Docker on a Linux Container (LXC), the Proxmox team recommends that you use a VM rather than LXC to benefit from application containerization.
This provides better isolation from the host which increases the security of the overall hypervisor. While you can use an LXC (and a lot of people do), it’s best to take the advice of the Proxmox team and install it this way.
How to Set Up Docker on Proxmox
1. Download the ISO image of Ubuntu Server (you can use any OS you’d like), select Create VM, then give the VM a name and select Next.
2. Select the Storage location, then the ISO Image, and select Next.
3. Change the System, Disks, CPU, Memory, and Network. After all of the settings have been configured to your specifications, confirm the settings and create the VM, then start it up!
4. After the VM starts, log in with the username and password you configured, then run the command below to update the system.
apt update && apt upgrade -y
5. After the system is updated, run each of the commands below one by one. These are taken directly from the official Docker documentation and are the prerequisites needed to install the latest version.
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
After the commands above are run, copy and run the command below.
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Finally, update the system.
sudo apt-get update
6. After all of the commands above have been run, run the command below to install!
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
7. At this point, Docker is fully configured and you’ll be able to create Containers. However, if you’d like a GUI, you can install Portainer using the command below.
docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
8. If you did install Portainer (and after it’s created), you’ll be able to access Portainer using the IP address of the container and port 9000.
https://[CONTAINER_IP]:9443
9. You can now access Portainer, create a username and password, and start using Docker on Proxmox!