Go back

Linux Installation and Initial Setup Guide - Part 4

Notes

Please note that this guide is recommended to be used together with the previous Part 3.

Last updated: 2025-10-09


Container Development Environment

Podman

Flatpak

Install it from Flathub:

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
$ flatpak install flathub io.podman_desktop.PodmanDesktop
$ flatpak run io.podman_desktop.PodmanDesktop

After launching it, you can basically follow the GUI setup wizard and continue through each step.

Once you reach the main page, the basic installation is complete.

For additional usage instructions, please refer to the user documentation.

Docker Engine

Fedora

To get started with Docker Engine on Fedora, make sure your system meets the prerequisites and then follow the installation steps below.

Operating System Requirements

To install Docker Engine, you need one of the following currently maintained Fedora versions:

  • Fedora 43
  • Fedora 42
  • Fedora 41
Uninstall Old Versions

Before installing Docker Engine, you need to remove any conflicting packages.

Your Linux distribution may provide unofficial Docker packages that can conflict with the official packages provided by Docker.

These packages must be removed before installing the official Docker Engine packages.

sudo dnf remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine

dnf may report that none of these packages are currently installed.

When Docker is uninstalled, images, containers, volumes, and network configurations stored under /var/lib/docker/ are not automatically removed.

Installation Methods

Depending on your requirements, there are three ways to install Docker Engine:

  • Use the official repository (recommended): makes installation and updates easier.
  • Manually download and install RPM packages: suitable for machines without Internet access.
  • Use the automated installation script: suitable for testing or development environments.

This guide will basically only cover installation using the official repository.

Install Using the Official Repository
  1. Configure the Docker repository

    First, install dnf-plugins-core, which is used to manage DNF repositories, and then configure the official Docker repository.

    sudo dnf -y install dnf-plugins-core
    sudo dnf-3 config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
    
  2. Install Docker Engine

    To install the latest version of Docker Engine, run:

    sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
    

    To install a specific version, specify the full package name.

    The full package name consists of the package name, such as docker-ce, followed by the version string <VERSION_STRING>, separated by a hyphen (-).

    For example:

    docker-ce-3:28.5.2-1.fc41

    # listing the available versions
    dnf list docker-ce --showduplicates | sort -r
    
    # example output
    docker-ce.x86_64    3:28.5.2-1.fc41    docker-ce-stable
    docker-ce.x86_64    3:28.5.1-1.fc41    docker-ce-stable
    <...>
    
    # install specific version
    sudo dnf install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io docker-buildx-plugin docker-compose-plugin
    

    Finally, if you are prompted to import a GPG key during installation, verify that the fingerprint is:

    060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35

    This fingerprint is shown when installing the latest version. I am not sure whether the same applies to specific older versions, so if you have any questions, please refer to the official documentation.

    This command installs Docker, but does not automatically start the service.

    The system will create a docker group, but no users will be automatically added to it.

  3. Start Docker

    Start Docker with:

    sudo systemctl enable --now docker
    

    Note that this also configures Docker to start automatically when the system boots.

    If you do not want Docker to start automatically at boot, use:

    sudo systemctl start docker
    
  4. Verify the Installation

    sudo docker run hello-world
    

    This downloads a test image and runs a container.

    If everything works correctly, it will print a confirmation message and then exit.

At this point, Docker Engine has been successfully installed and started.

Docker Engine Post-installation Steps for Linux

The following optional post-installation steps can help Docker integrate more smoothly with your Linux system.

Allow Non-root Users to Use Docker

The Docker daemon binds to a Unix socket rather than a TCP port.

By default, this socket is owned by the root user, and other users can only access it through sudo.

The Docker daemon always runs as root.

If you do not want to add sudo every time you run a docker command, you can create a group named docker and add users to it.

When the Docker daemon starts, it creates a Unix socket that can be accessed by members of the docker group.

Warning:

Adding a user to the docker group effectively grants that user root-level privileges.

For details, see the official documentation:

https://docs.docker.com/engine/security/#docker-daemon-attack-surface

Note:

If you want to run Docker entirely without root privileges, see:

https://docs.docker.com/engine/security/rootless/

Create the Docker Group and Add a User
  1. Create the docker group:

    sudo groupadd docker
    
  2. Add the current user to the group:

    sudo usermod -aG docker $USER
    
  3. Log out and log back in for the group membership change to take effect.

    Alternatively, you can apply the change immediately with:

    newgrp docker
    
  4. Test whether Docker commands can be run without sudo:

    docker run hello-world
    

This command downloads a test image and starts a container.

If it runs successfully, a confirmation message will be displayed before the container exits.

If you previously ran Docker commands using sudo before joining the group, you may encounter the following error:

WARNING: Error loading config file: /home/user/.docker/config.json -
stat /home/user/.docker/config.json: permission denied

This means that the permissions on the ~/.docker/ directory are incorrect because Docker was previously run with sudo.

You can fix the permissions with:

sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
sudo chmod g+rwx "$HOME/.docker" -R
Configure Docker to Start Automatically at Boot with systemd

Most modern Linux distributions use systemd to manage services that start during boot.

On Debian and Ubuntu, Docker starts automatically at boot by default.

If you are using another systemd-based distribution, you can configure it manually:

sudo systemctl enable docker.service
sudo systemctl enable containerd.service

If you do not want them to start automatically, use:

sudo systemctl disable docker.service
sudo systemctl disable containerd.service
Configure the Default Logging Driver

Docker provides several logging drivers for collecting and viewing container log data.

The default json-file driver writes logs to the host filesystem in JSON format.

Over time, these files can become very large and may eventually consume a significant amount of disk space.

To prevent logs from filling up the disk, consider one of the following approaches:

  • Enable log rotation for the json-file driver.
  • Use the local driver, which provides automatic log rotation.
  • Use a driver that sends logs to a remote collection system, such as syslog or fluentd.

Notes

I originally planned to include instructions for installing Docker Desktop as well.

However, I later realized that the way Docker Desktop is implemented on Linux is a bit too bizarre for my taste.

Architecture diagram:

image

Source: https://www.geeksforgeeks.org/devops/understanding-the-docker-desktop-architecture-and-linux-building-block-for-containers/

An architecture diagram mentioned in one of Docker’s official blog posts:

image

Source: https://www.docker.com/blog/how-docker-desktop-networking-works-under-the-hood/

Docker itself also states:

When containers want to connect to the outside world, they will use TCP/IP. Since Linux containers require a Linux kernel, Docker Desktop includes a helper Linux VM. Traffic from containers therefore originates from the Linux VM rather than the host, which causes a serious problem.

In other words, Docker Desktop effectively runs a VM inside Linux in order to run Docker.

Using WSL and a virtualized Linux environment on Windows is understandable, since Windows does not natively provide the Linux kernel required by Linux containers.

But doing something similar on Linux itself feels like an unnecessary waste of resources.

So after discovering this, I changed my mind.

I had been quite happy using Docker Desktop’s GUI on Windows, and since Windows already needs WSL for Linux containers anyway, that setup made sense there.

On Linux, however, I would rather just stick with the command line.

Alternatively, Podman Desktop is also available if you prefer a graphical interface.