Installing Docker in a Proxmox LXC

Docker in Proxmox CT!

Harish Thangadurai
3 min readNov 19, 2023

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.

Prerequisites:

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.
  • 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
  • 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

Note: If any error occurs try running the same set of commands by logging back in using the root user

  • 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
  • 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!!!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Harish Thangadurai
Harish Thangadurai

Written by Harish Thangadurai

👨‍💻 Automation Engineer | 🌍Tech Explorer | 🧠 Lifelong Learner

No responses yet

Write a response