3 min read

Installing Docker in a Proxmox LXC


In the past articles, we had successfully created a Debian LXC in Proxmox. We also reviewed the step-by-step instructions for creating a new user in the LXC and added the same user to the 'sudo' group to enable the user to run commands with elevated permissions.

Now in this article, we will be diving deeper into how to install docker and docker-compose in a Proxmox LXC.


We need to make a change in our Proxmox Environment in order to install docker and docker-compose in a LXC.

  • We need to enable the 'overlay' and 'aufs' kernel modules in our Proxmox first. This is done to support Docker-LXC-Nesting. We can type in the below command to enable the same.
echo -e "overlay\naufs" >> /etc/modules-load.d/modules.conf
  • Now we need to reboot our Proxmox environment i.e., our Home Lab in order for the changes to reflect. We can check if the changes have been reflected after reboot using the below command.
lsmod | grep -E 'overlay|aufs'

Steps to install Docker:

  • In the past article, we created an Unprivileged LXC and enabled the FUSE, keyctl, and nesting features on it. We will be using the same LXC for installing the docker and docker-compose.
  • If you don't have an LXC created, make sure to follow this article and get the LXC created before proceeding further.
Creating and Configuring a LXC in Proxmox
In the past articles, we have successfully installed Proxmox on our Home Server system and have also installed and configured TrueNAS as our storage solution. We are now ready to start deploying services in our Home Lab. The plan here is that we will be deploying the services as a
  • Now we can log in to the LXC either using the Proxmox Console or via SSH.
  • First, we need to update the LXC. We can use the below command for the same.
sudo apt-get update && apt-get upgrade && apt-get dist-upgrade && apt-get autoremove
LXC Update
  • We now can type in the below-listed commands one by one to add the docker-related repos to our apt sources.
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add the repository to Apt sources:
echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

# Update the packages once
sudo apt-get update
If any error occurs try running the same set of commands by logging back in using the root user
Adding Docker Repo to apt sources
  • Finally, we can install docker and docker-compose along with related packages with the help of the below command.
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-compose
Installing Docker
  • Docker has been installed successfully and we can verify the same if the installation is successful by running the hello-world image.
sudo docker run hello-world

In this article, we have looked into the installation steps of docker and docker-compose. We also have successfully installed the same in our Home Lab and have validated if it works by running the hello-world docker container.

In the further articles, we will be looking into the services that I have in my Home Lab and am using regularly. We will also be covering the installation and configuration parts for those services. Stay tuned for more detailed instructions on expanding our Home Labbing capabilities.

Happy Homelabbing!!!