Skip to content
Runbook

Install Docker on Fedora / RHEL

Container engine to package, distribute, and run applications in isolation.

Containerscontainercontainerdevopscomposeoci

Installation

Official DNF repository · dnf
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager addrepo --from-repofile https://download.docker.com/linux/fedora/docker-ce.repo
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Fedora 41+ uses DNF5: the subcommand is config-manager addrepo --from-repofile. On older DNF4 versions, use dnf config-manager --add-repo (or dnf-3 config-manager --add-repo).

Verify the installation

Verify
docker --version
sudo docker run --rm hello-world

Service

Start
sudo systemctl start docker
Stop
sudo systemctl stop docker
Status
sudo systemctl status docker
Restart
sudo systemctl restart docker
On boot
sudo systemctl enable --now docker

Important files

TypePathDescription
config/etc/docker/daemon.jsonDaemon configuration (registries, log driver, address range). Create it if absent.
data/var/lib/dockerImages, containers, volumes, and filesystem layers.
socket/var/run/docker.sockUnix socket through which the client talks to the daemon.

Command-line tools

  • dockerCommand-line client to manage images and containers.
  • docker composeMulti-container orchestration (docker-compose-plugin plugin).

Uninstall

Uninstall the packages
sudo dnf remove -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
Remove data and config
sudo rm -rf /var/lib/docker /var/lib/containerd /etc/docker

Destructive: erases all images, containers, and volumes.

Good to know

  • Add your user to the docker group to avoid sudo: sudo usermod -aG docker $USER (then log back in). This is equivalent to root access.
  • On the first sudo dnf install, DNF asks you to accept Docker's repository GPG key: verify that the displayed fingerprint matches 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35 before accepting.
  • Fedora uses SELinux: leave it enabled, the official Docker engine sets the correct contexts. If you hit a volume issue, mount with the :Z option.
  • Never apply :Z or :z to a shared system directory (/usr, /etc, /var, an entire $HOME, etc.): the SELinux relabel is recursive and destructive, and can break the system. Reserve :Z/:z for a dedicated data directory.

Installation on Fedora

The official Docker engine (docker-ce) is not part of the Fedora repositories, which instead offer moby-engine and podman. So add Docker's RPM repository with config-manager. Fedora 41 and later use DNF5, where the --add-repo option has been removed: the primary method is sudo dnf config-manager addrepo --from-repofile https://download.docker.com/linux/fedora/docker-ce.repo. On older DNF4 versions, use the fallback sudo dnf config-manager --add-repo … (or sudo dnf-3 config-manager --add-repo …). The package meta-set installs the engine, the client, containerd, Buildx, and the Compose plugin. On the first sudo dnf install, accept Docker's repository GPG key only after verifying its fingerprint (060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35).

If Podman was installed, it may provide a docker alias: check with which docker that the command really points to /usr/bin/docker from the docker-ce package.

Service, SELinux, and configuration

Enable the service with sudo systemctl enable --now docker. Fedora enforces SELinux in enforcing mode: the official engine is designed to work with it, so do not disable it. When a container needs to write to a host volume, add the :Z suffix (or :z for a shared mount) to the mount so SELinux labels the files correctly, for example -v /host/path:/data:Z. Warning: never apply :Z or :z to a shared system directory (/usr, /etc, /var, an entire $HOME, etc.). The SELinux relabel is recursive and destructive, and can render the system unusable; reserve these suffixes for a dedicated data directory.

The daemon configuration goes in /etc/docker/daemon.json (create it if absent), followed by sudo systemctl restart docker. The data resides in /var/lib/docker; monitor disk space and use docker system prune to reclaim the space taken by unused images and layers.