Docker & Portainer Installation on Fedora & Debian¶
This guide is for users who are new to Docker and are running Fedora or Debian Linux. We will go through the installation of Docker and Portainer, a web-based GUI for managing Docker containers. This guide is hands-on and will provide step-by-step instructions to ensure a working setup.
Why Use Portainer?¶
Portainer is a lightweight management UI for Docker, making container management easier, especially for those new to the command line. It provides: - A web-based dashboard to manage containers, images, networks, and volumes. - Ease of use, eliminating the need to remember complex Docker commands. - Support for multiple environments, including standalone Docker, Swarm, and Kubernetes.
Prerequisites¶
Before starting, ensure you have: - Fedora or Debian Linux installed. - A user with sudo privileges. - A stable internet connection.
Step 1: Update System¶
For Fedora:
sudo dnf update -y
For Debian:
sudo apt update && sudo apt upgrade -y
This will update all system packages to their latest versions.
Step 2: Install Docker¶
2.1: Add Docker Repository¶
For Fedora:
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
For Debian:
sudo apt install -y ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo tee /etc/apt/keyrings/docker.asc > /dev/null
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
2.2: Install Docker Engine¶
For Fedora:
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
For Debian:
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
2.3: Start and Enable Docker Service¶
For both Fedora and Debian:
sudo systemctl start docker
sudo systemctl enable docker
2.4: Verify Docker Installation¶
Check if Docker is running:
sudo systemctl status docker
Run a test container to verify installation:
sudo docker run hello-world
If successful, you should see a message confirming that Docker is installed correctly.
2.5: Allow Running Docker Without Sudo (Optional)¶
sudo usermod -aG docker $USER
Log out and log back in to apply the changes, or run:
newgrp docker
Now you should be able to run docker ps
without sudo
.
Step 3: Install Portainer¶
3.1: Create a Directory for Portainer Data¶
mkdir -p $HOME/portainer_data
3.2: Deploy Portainer Using Docker¶
docker run -d \
--name=portainer \
--restart=always \
-p 8000:8000 \
-p 9443:9443 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $HOME/portainer_data:/data \
portainer/portainer-ce:latest
3.3: Verify Portainer is Running¶
docker ps | grep portainer
3.4: Access Portainer Web UI and Login¶
Now, open a web browser and go to:
https://localhost:9443
- You will see a security warning since Portainer uses a self-signed certificate. Click "Advanced" → "Proceed".
- Set up an admin username and password when prompted.
- Log in with your newly created credentials.
- Select Local as the environment and click Connect.
Step 4: Using Docker Compose for Portainer¶
4.1: Install Docker Compose¶
For Fedora:
sudo dnf install -y docker-compose
For Debian:
sudo apt install -y docker-compose
4.2: Create a Docker Compose File¶
mkdir -p $HOME/portainer_compose && cd $HOME/portainer_compose
nano docker-compose.yml
Add the following content:
version: '3.8'
services:
portainer:
image: portainer/portainer-ce:latest
container_name: portainer
restart: always
ports:
- "8000:8000"
- "9443:9443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- $HOME/portainer_data:/data
4.3: Start Portainer Using Docker Compose¶
docker compose up -d
4.4: Stopping and Removing Portainer¶
docker compose down
Step 5: Updating Portainer Using Docker Compose¶
cd $HOME/portainer_compose
docker compose pull
docker compose up -d --force-recreate
Conclusion¶
You now have a fully working Docker and Portainer setup on Fedora and Debian. You can manage your Docker environment using either Docker CLI or Docker Compose for a more structured deployment.
If you run into any issues, you can check logs using:
docker logs portainer
Enjoy your Docker journey with Portainer!