Docker is a popular containerization platform that allows developers to package applications and their dependencies into lightweight, portable containers. In this guide, we’ll walk through the installation of both Docker and Docker Desktop on Fedora.
Prerequisites
- Fedora 35 or later
sudo
privileges- Internet connectivity
Step 1: Update Your System
Before installing Docker, ensure your system is up to date:
sudo dnf update -y
Step 2: Add the Docker Repository
Fedora does not include Docker in its default repositories, so you need to add the official Docker repository:
sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
Step 3: Install Docker
Once the repository is added, install Docker with:
sudo dnf install -y docker-ce docker-ce-cli containerd.io
Step 4: Enable and Start Docker
To start Docker and enable it to launch at boot:
sudo systemctl enable --now docker
Step 5: Verify Installation
Check if Docker is running correctly:
sudo systemctl status docker
You can also verify by running a test container:
sudo docker run hello-world
If you see a message confirming that Docker is working, the installation was successful.
Step 6: Add Your User to the Docker Group (Optional)
To run Docker without sudo
, add your user to the docker
group:
sudo usermod -aG docker $USER
Log out and log back in, or run:
newgrp docker
Test if it works without sudo
:
docker run hello-world
Step 7: Enable Docker on Boot (Optional)
If you want Docker to start automatically on system boot:
sudo systemctl enable docker
How to Install Docker Desktop on Fedora
Docker Desktop is a GUI tool for managing containers and images. Since Fedora does not officially support Docker Desktop, we will use an alternative approach.
Step 1: Install Dependencies
Ensure curl
, dnf-plugins-core
, and wget
are installed:
sudo dnf install -y curl dnf-plugins-core wget
Step 2: Download Docker Desktop RPM Package
Download the latest Docker Desktop package from the official website:
wget https://desktop.docker.com/linux/main/amd64/docker-desktop-latest.rpm
Step 3: Install Docker Desktop
Use dnf
to install the downloaded package:
sudo dnf install -y ./docker-desktop-latest.rpm
Step 4: Start Docker Desktop
To start Docker Desktop, run:
docker-desktop
If you encounter issues with Wayland, try launching it with:
QT_QPA_PLATFORM=xcb docker-desktop
Step 5: Enable Docker Desktop on Startup (Optional)
To automatically start Docker Desktop on login:
mkdir -p ~/.config/autostart
cp /usr/share/applications/docker-desktop.desktop ~/.config/autostart/
Step 6: Verify Docker Desktop Installation
Ensure Docker Desktop is running:
docker info
If you see the Docker version and system information, the installation was successful.
Uninstall Docker and Docker Desktop (If Needed)
If you ever need to remove Docker and Docker Desktop, use:
sudo dnf remove -y docker-ce docker-ce-cli containerd.io docker-desktop
sudo rm -rf /var/lib/docker /var/lib/containerd
Conclusion
You have successfully installed both Docker and Docker Desktop on Fedora! You can now start using containers for development, testing, and deployment.
For more details, visit the official Docker documentation.