Proxmox Docker: Installation and Best Practices

Proxmox Docker

Table of Contents

Get up to 50% off now

Become a partner with CyberPanel and gain access to an incredible offer of up to 50% off on CyberPanel add-ons. Plus, as a partner, you’ll also benefit from comprehensive marketing support and a whole lot more. Join us on this journey today!

Proxmox Virtual Environment (Proxmox VE) is one of the most powerful open source platforms for virtualization and container management, which is widely used for running VMs and Linux Containers (LXC). Combining it with a containerizing application, such as Docker makes many developers and system administrators want to use them together. 

Proxmox Docker combination allows you to benefit from PVE’s resource management, snapshots, and clustering and leverage Docker’s simplicity for application deployment at the same time. 

In this guide, we will walk through the different approaches to run Proxmox Docker, the installation steps, and how to make the most out of this hybrid setup. 

Can You Run Docker on Proxmox?

You can run Docker on Proxmox using these two primary approaches: 

  1. Docker in a Proxmox VM: this is one of the most common methods and you can create a virtual machine, install Docker, and manage in the regular manner. This offers high flexibility due to strong isolation and compatibility with Docker features. 
  2. Docker in a Proxmox LXC Container: this is a lighter option where you can run Docker inside an LXC container. This requires less resources as compared to a completely isolated VM. 

Both methods are reliable and the choice depends on your team and security requirements. 

Installing Docker on Proxmox

Here is how you can install Docker on Proxmox in the two main ways described above: 

Tech Delivered to Your Inbox!

Get exclusive access to all things tech-savvy, and be the first to receive 

the latest updates directly in your inbox.

Installation in a VM (Debian/Ubuntu)

Using an isolated Virtual Machine, you need to: 

  1. Create a VM in Proxmox and choose either Debian or Ubuntu for compatibility. Also assign and employ the required resources, such as CPU, RAM, and storage. 
  2. Then update the system, using: sudo apt update && sudo apt upgrade -y
  3. Install the Docker dependencies using:

sudo apt install apt-transport-https ca-certificates curl software-properties-common -y

  1. Add Docker’s official GPG key and repositories:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg –dearmor -o /etc/apt/trusted.gpg.d/docker.gpg

echo “deb [arch=$(dpkg –print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable” | sudo tee /etc/apt/sources.list.d/docker.list

sudo apt update

  1. Install Docker Engine

sudo apt install docker-ce docker-ce-cli containerd.io -y

  1. Run Docker without sudo

sudo usermod -aG docker $USER

newgrp docker

Now you can run containers inside your Proxmox VM like on any other server.

Installation in an LXC Container

  1. Create an LXC container in Proxmox using a Debian/Ubuntu template. Enable nesting and (if needed) privileged mode in the container options.
  2. Update the container by running: apt update && apt upgrade -y
  3. Install required dependencies:

apt install apt-transport-https ca-certificates curl software-properties-common -y

Enhance Your CyerPanel Experience Today!
Discover a world of enhanced features and show your support for our ongoing development with CyberPanel add-ons. Elevate your experience today!

  1. Add Docker’s GPG key and repo, then install

Same as the VM steps:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg –dearmor -o /usr/share/keyrings/docker.gpg

echo “deb [arch=$(dpkg –print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable” | tee /etc/apt/sources.list.d/docker.list > /dev/null

apt update

apt install docker-ce docker-ce-cli containerd.io -y

  1. Verify Docker installation by running docker run hello-world

Proxmox and Docker Networking

Networking is one of the most important considerations when running Docker on Proxmox, as it impacts how containers communicate with each other, the hosts, and the outside world. 

  • Bridge Networking (vmbr0): Most of the Proxmox setups use a Linux bridge that is connected to the host NIC. Both VMs and LXC containers can use this specific bridge, which gives Docker containers direct access to the LAN. 
  • NAT Networking: using NAT networking, you can assign private IPs to VMs or LXCs and then use NAT for outbound traffic. This is a better and more secure manner but it requires port forwarding for external access. 
  • Docker Networking Modes: inside your VML/LXC, Docker supports bridge, host, overlay, and macvlan networks.

Storage Considerations for Proxmox Docker

Storage considerations have an effect on both Docker’s performance and reliability on Proxmox. 

  • Use Docker volumes or bind mounds for a continuous storage stream instead of containers. 
  • Proxmox has multiple backends like ZFS, Ceph, LVM, or NFS to store data for scalable and redundant storage. 
  • Proxmox snapshots work best when Docker data is stored on mounted volumes rather than inside ephemeral containers. 
  • Use ZFS or Ceph storage pools in Proxmox and map them into Docker redundancy and easy recovery. 

Managing Docker on Proxmox

Managing Docker inside Proxmox VMs or LXCs is similar to managing it on a separate server, but Proxmox adds an added layer of flexibility. 

FeatureFunctionalityDescription
PortainerContainer & image managementA lightweight GUI for managing Docker containers, images, and networks. Can be installed inside the VM/LXC.
Docker ComposeMulti-container orchestrationUseful for defining and running multi-container apps. Works normally in both Proxmox VMs and LXCs.
Resource AllocationCPU/RAM quota controlProxmox lets you set CPU/RAM quotas per VM or LXC, preventing Docker containers from consuming all host resources.
Cluster ManagementNode migration & scalingWith Proxmox clusters, you can migrate VMs/LXCs running Docker to other nodes, but persistent storage must be handled properly.

Performance: Docker on VM vs LXC in Proxmox

When running Docker on Proxmox, performance is highly dependent on the approach that you are using: 

  • Virtual Machines offer a better isolation factor but increases the overhead costs due to virtualization. They are an ideal solution for production that require intense security, snapshots, and compatibility. 
  • LXC Containers are more lightweight in comparison and efficient, which offers a bare-metal performance. 

In general, for maximum speed and resource efficiency, Docker in LXC is faster, but Docker in a VM is safer for mission-critical deployments.

Security Considerations with Proxmox and Docker

Security is another important consideration while implementing Proxmox with Docker. The two methods have different security restrictions, such as:

  • Running Docker inside a Virtual Machine offers an extra layer of isolation between the containers and the host. It is mostly recommended for untrusted or public Docker workloads. 
  • Running Docker inside an LXC container is less secure since LXC has a shared kernel. 

Common Issues and Fixes For Proxmox Docker 

IssueCauseFix
Docker fails to start in LXCMissing cgroup support or incorrect configEnable nesting=1 and keyctl=1 in LXC container options
Network issues with containersMisconfigured Proxmox bridges or firewallVerify bridge setup in /etc/network/interfaces and check firewall rules
Slow performance in VMsLimited resources or default disk settingsAssign more vCPUs/RAM and enable VirtIO for networking and storage
Storage errors in DockerUsing unsupported storage driverSwitch to overlay2 driver and ensure ext4/xfs filesystem support
High resource usageToo many containers or unoptimized workloadsUse monitoring tools like htop, docker stats, and optimize container resource limits

Conclusion

Running Docker on Proxmox offers increased flexibility and allows you to choose between VMs or LXC containers for better isolation and performance respectively. By learning the two approaches in detail, you can make the best decision for your team. 

FAQs

What’s the best way to install Docker on Proxmox?

The easiest and most reliable method is to install Docker inside a Debian or Ubuntu VM. You can use the official Docker installation script for a clean setup.

How does networking work for Docker on Proxmox?

You can bridge the Docker network to the Proxmox bridge (like vmbr0) to enable external access. For multiple containers, use Docker’s bridge or macvlan networks for better traffic separation.

Are there any performance differences between Docker on VM and LXC?

Yes. LXCs have slightly better performance due to reduced virtualization overhead, but VMs offer more flexibility, security, and compatibility with complex Docker workloads.

Marium Fahim
Hi! I am Marium, and I am a full-time content marketer fueled by an iced coffee. I mainly write about tech, and I absolutely love doing opinion-based pieces. Hit me up at [email protected].
Unlock Benefits

Become a Community Member

SIMPLIFY SETUP, MAXIMIZE EFFICIENCY!
Setting up CyberPanel is a breeze. We’ll handle the installation so you can concentrate on your website. Start now for a secure, stable, and blazing-fast performance!