Fedora ships with Podman out of the box, and for most container tasks it works fine. But if your workflow depends on Docker Compose, BuildKit, or Swarm, you need Docker CE. The official Docker repository has supported Fedora 42 since launch, so installation is straightforward.
This guide walks through installing Docker CE on Fedora 42 and 41, including the DNF5 syntax change that trips people up when following older tutorials. We also cover running containers as a non-root user, testing with Docker Compose, and the key differences between Fedora 42 and 41.
Tested April 2026 on Fedora 42 (Cloud Edition) with Docker CE 29.4.0, Docker Compose v5.1.1
Prerequisites
You need a running Fedora 42 or 41 system with sudo privileges. A minimal or cloud installation works perfectly. These steps were tested on Fedora 42 Cloud Edition but apply to Workstation and Server editions as well.
Remove Conflicting Packages
Older Docker packages from the default Fedora repos can conflict with Docker CE. Remove them first:
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
If none of these packages are installed, DNF will report “No match for argument” and exit cleanly. That’s expected on a fresh system.
Add the Docker CE Repository
Install the DNF plugins package, then add Docker’s official Fedora repository. One thing that catches people: Fedora 42 ships DNF5 with different syntax than Fedora 41’s DNF4.
Install the prerequisite:
sudo dnf install -y dnf-plugins-core
On Fedora 42 (DNF5), add the repo with:
sudo dnf config-manager addrepo --from-repofile=https://download.docker.com/linux/fedora/docker-ce.repo
On Fedora 41 (DNF4), the syntax is different:
sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
Using the wrong syntax for your Fedora version will produce an error. If you see unrecognized arguments or no such command, check which DNF version you’re running with dnf --version.
Install Docker CE
With the repository configured, install Docker CE along with the CLI tools, containerd, BuildKit, and the Compose plugin:
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
DNF pulls in the following packages (versions at time of testing):
Installed:
containerd.io-2.2.2
docker-ce-29.4.0
docker-ce-cli-29.4.0
docker-buildx-plugin
docker-compose-plugin-5.1.1
Start and Enable Docker
Enable the Docker daemon so it starts on boot and start it immediately:
sudo systemctl enable --now docker
Confirm the service is running:
sudo systemctl status docker
The output should show active (running) with the docker.socket trigger:
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; preset: disabled)
Drop-In: /usr/lib/systemd/system/service.d
└─10-timeout-abort.conf
Active: active (running)
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 1234 (dockerd)
Tasks: 8
Memory: 112.0M
CPU: 850ms
CGroup: /system.slice/docker.service
└─1234 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Verify the Installation
Check the installed Docker version:
docker --version
Expected output:
Docker version 29.4.0, build 9d7ad9f
Verify Docker Compose is available:
docker compose version
You should see:
Docker Compose version v5.1.1
For detailed engine information, run docker info. Key values to confirm on Fedora 42:
docker info
Look for these lines in the output:
Storage Driver: overlayfs
Cgroup Driver: systemd
Cgroup Version: 2
Kernel Version: 6.14.0-63.fc42.x86_64
Operating System: Fedora Linux 42 (Cloud Edition)
Fedora 42 uses cgroup v2 exclusively, and Docker handles this without any extra configuration.
Run the Hello World Container
The classic sanity check:
sudo docker run hello-world
Docker pulls the image from Docker Hub and runs it. The output confirms everything is working:
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
e6590344b1a5: Pull complete
Digest: sha256:...
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
SELinux and Docker
Fedora runs SELinux in enforcing mode by default. Confirm with:
getenforce
Output:
Enforcing
Docker CE works with SELinux enforcing on Fedora without any modifications. The Docker packages include the correct SELinux policies. Never disable SELinux to make Docker work. If you run into permission issues with bind mounts, use the :z or :Z volume flags:
sudo docker run -v /host/path:/container/path:z nginx
The :z flag relabels the content to be shared among containers. Use :Z (capital) for private, unshared content.
Run Docker as a Non-Root User
Running every Docker command with sudo gets old fast. Add your user to the docker group:
sudo usermod -aG docker $USER
Log out and back in (or run newgrp docker) for the group membership to take effect. After that, Docker commands work without sudo:
docker run hello-world
Be aware that adding a user to the docker group grants root-equivalent access to the Docker daemon. On shared systems, consider rootless Docker or Podman instead.
Test Docker Compose
Create a project directory and a simple Compose file to verify multi-container orchestration works:
mkdir ~/compose-test && cd ~/compose-test
Create the Compose file:
cat > docker-compose.yml << 'YAML'
services:
web:
image: nginx:alpine
ports:
- "8080:80"
depends_on:
- cache
cache:
image: redis:alpine
YAML
Bring the stack up:
docker compose up -d
Both containers should start and show a healthy state:
docker compose ps
You should see both web and cache services running:
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
compose-test-web-1 nginx:alpine "/docker-entrypoint.…" web 5 seconds ago Up 4 seconds 0.0.0.0:8080->80/tcp
compose-test-cache-1 redis:alpine "docker-entrypoint.s…" cache 5 seconds ago Up 4 seconds 6379/tcp
Test that Nginx responds on port 8080:
curl -s http://localhost:8080 | head -5
Clean up when done:
docker compose down
Podman vs Docker on Fedora
Fedora includes Podman as the default container runtime. Both tools can coexist on the same system without conflicts. Podman runs containers rootless by default and integrates tightly with systemd, which makes it a solid choice for running containers as system services.
Docker CE is the better option when your project uses Docker Compose (Podman's compose support is improving but not feature-complete), BuildKit for advanced image builds, or Docker Swarm for orchestration. Most CI/CD pipelines and development workflows still target the Docker API, so if you're building container images for production, Docker CE avoids compatibility surprises.
For purely running containers on a server, either tool works. Pick whichever matches your team's workflow.
Differences Between Fedora 42 and 41
Both releases use the same Docker CE repository, and Docker itself behaves identically on both. The main differences are at the OS level:
DNF version: Fedora 42 uses DNF5, which changed the config-manager subcommand syntax. Fedora 41 still uses DNF4. The repo-adding command is the only installation step affected by this change (shown in the Add Repository section above).
Kernel: Fedora 42 ships kernel 6.14.x, while Fedora 41 runs 6.11.x. Both kernels fully support overlayfs and cgroup v2, so Docker performance and features are the same across both.
Package versions: Docker CE 29.4.0 and Docker Compose 5.1.1 are available on both Fedora 42 and 41 from the Docker repository since the packages are not tied to the Fedora release version.
Troubleshooting
Error: "unrecognized arguments: --add-repo"
This happens when you use the DNF4 syntax (--add-repo) on Fedora 42 which runs DNF5. Use the DNF5 syntax instead:
sudo dnf config-manager addrepo --from-repofile=https://download.docker.com/linux/fedora/docker-ce.repo
Error: "permission denied while trying to connect to the Docker daemon socket"
Your user is not in the docker group, or you haven't logged out and back in after adding it. Run groups to check your current group membership. If docker is not listed, add yourself with sudo usermod -aG docker $USER and start a new login session.
Docker service fails to start after Fedora upgrade
If you upgraded from an older Fedora release, stale Docker packages from the base repos can conflict with Docker CE. Remove them (see the "Remove Conflicting Packages" section), then reinstall Docker CE from the official repository.
Configure Docker Daemon Options
The Docker daemon reads its configuration from /etc/docker/daemon.json. Create or edit this file to customize storage drivers, logging, or default address pools. A practical starting point:
sudo vi /etc/docker/daemon.json
Add the following configuration:
{
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3"
},
"default-address-pools": [
{
"base": "172.20.0.0/16",
"size": 24
}
]
}
Restart Docker to apply changes:
sudo systemctl restart docker
The log rotation settings prevent container logs from eating disk space, which is a common problem on long-running development machines. The address pool configuration avoids subnet conflicts if your LAN uses the default Docker bridge range.
Open Firewall Ports
Fedora uses firewalld. If you need to expose container ports to other machines on your network, allow them through the firewall. For example, to open port 8080:
sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --reload
Docker modifies iptables directly for published ports, so containers accessible via -p flags typically work without manual firewall rules on the host itself. The firewall configuration matters more when other services (not Docker) need to reach containers, or when you're running Docker Swarm.
For Docker installation on other distributions, see our guides for Ubuntu 24.04, Debian 13/12, and Rocky Linux/AlmaLinux.