Docker is a core part of every modern homelab server setup. It allows you to create isolated instances of apps and also making it easy for you to manage and migrate across different deployments. Learn how to install Docker on some of the most popular Homelab server systems today.
Installing Docker on Debian
The first step in installing Docker on Debian is to import the developers’ repository details to the apt package manager. This allows you to get Docker and its plugins without relying on a third-party maintainer.
Start by installing both curl
and gpg
on your Debian home system. These apps will allow you to pull the repository signing key as well as add it to your system’s keyring:
sudo apt install curl gpg
Note: Debian only installs sudo if you didn’t set a root password during installation. If your system doesn’t have sudo, you can either set it up first or switch to the root user using su
.
Import the signing key for the Docker developers’ package repository:
sudo curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg sudo chmod a+r /etc/apt/keyrings/docker.gpg
Create a new repository file
sudo nano /etc/apt/sources.list.d/docker.list
and add the following repository information:
deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian bookworm stable
Save and exit your new repository file. In nano, you can do this by pressing Ctrl + X, typing “Y” on the prompt, then pressing Enter on the default file path.
Refresh your system’s package repos, then perform a full system upgrade:
sudo apt update && sudo apt upgrade -y
Install the core Docker package along with its companion plugin Compose:
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-buildx-plugin
Confirm that Docker is working properly on your system by restarting your machine and running the following command:
sudo docker —version
Add yourself to the docker
group so you can run docker without root:
sudo usermod -aG docker $USER
Installing Docker on Ubuntu
Similar to Debian, deploying Docker on Ubuntu starts with importing the repository signing key for the official Docker repo:
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
Create a new repository file for Docker using your favorite text editor:
sudo nano /etc/apt/sources.list.d/docker.list
Paste the following line of code inside your new repository file:
deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu noble stable
Refresh the system’s repo listings and update your Ubuntu machine:
sudo apt update && sudo apt upgrade -y
Install the Docker engine package along with its dependencies and plugins:
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-buildx-plugin
Add your regular user to the docker system group. This will ensure that you can run Docker even without sudo
:
sudo usermod -aG docker $USER && logout
Log back in to your system and test your new installation by creating and running the “hello-world” Docker container:
docker run hello-world
Installing Docker on Fedora
Unlike Debian and Ubuntu, you don’t need to create a repository file and import signing keys to install Docker on Fedora. Instead, you can directly import the developer’s repo file into the DNF package manager.
Begin by installing the core plugins for DNF. This will allow you to add and manage external repositories directly from DNF:
sudo dnf install -y dnf-plugins-core
Import the official Docker repofile for Fedora using the “config-manager” subcommand:
sudo dnf-3 config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
Reload your OS’ package listing by performing a system update:
sudo dnf update
Install Docker along with its core plugins and dependencies by running the following command:
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Start the Docker service daemon on your machine:
sudo systemctl enable --now docker.service
Add your current user to the Docker system group:
sudo usermod -aG docker $USER && logout
After logging back in, check if Docker is working properly by building the hello-world container:
docker run hello-world
Installing Docker on Rocky Linux
Just like with Fedora, installing Docker on Rocky Linux only requires you to import the official repository URL from the developer’s website:
sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
Fetch and install Docker, its dependencies and plugins:
sudo dnf -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-buildx-plugin
Enable the Docker server on your Rocky Linux home server:
sudo systemctl enable --now docker.service
After that, confirm that you’ve installed the program properly on the machine by adding your user account to the Docker system group and running a simple container.
Installing Docker on Arch Linux
In contrast to other systems, Arch Linux provides an up-to-date version of Docker and Docker Compose in its default repositories. This means that you don’t need to import an external repository and can immediately use pacman to install the program:
sudo pacman -S docker docker-compose docker-buildx
Add your regular user to your Docker system group:
sudo usermod -aG docker $USER
Enable and start the Docker systemd process:
sudo systemctl enable --now docker.service sudo systemctl start docker.service
Test whether Docker is working properly in Arch Linux by running the following command:
docker run hello-world
Installing Docker on some of the popular home server OSes today is just the tip of the iceberg when it comes to self-hosting. Learn how to secure your home server today by checking out our guide to setting up a firewall on Linux.
Image credit: unsplash. All screenshots and alterations by Ramces Red.
Be the first to comment! Get the discussion going.