How to install Docker and Setup Docker on Debian and RED HAT based linux ( Without GUI) ?
zlaam
July 3, 2026·18 views1
Debian/Ubuntu Base Distros e.g
1. Remove old Docker packages (if installed)
sudo apt remove docker.io docker-compose docker-compose-v2 docker-doc podman-docker containerd runc
2. Update packages
sudo apt update
sudo apt install -y ca-certificates curl
3. Add Docker's official GPG key
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
-o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
4. Add the Docker repository
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] \
https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo $VERSION_CODENAME) stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
5. Install Docker Engine and CLI
sudo apt install -y \
docker-ce \
docker-ce-cli \
containerd.io \
docker-buildx-plugin \
docker-compose-plugin
This installs:
- Docker Engine
- Docker CLI
- Containerd
- Docker Buildx
- Docker Compose v2
6. Verify installation
sudo systemctl status docker
If it's not running:
sudo systemctl enable --now docker
8. (Optional) Run Docker without sudo
sudo usermod -aG docker $USER
newgrp docker
REDHAT/Fedora
To install the Docker CLI and Docker Engine on Fedora (without Docker Desktop), follow these steps:
1. Uninstall Old Versions (if any)
Remove any old or conflicting Docker 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
2. Set Up Docker's Repository
Add Docker's official repository:
sudo dnf config-manager addrepo --from-repofile https://download.docker.com/linux/fedora/docker-ce.repo
3. Install Docker Engine and CLI
To install the latest version:
sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- If prompted, accept the GPG key.
4. Start and Enable Docker
Start Docker and enable it to start on boot:
sudo systemctl enable --now docker
5. Verify Installation
Run the hello-world container to verify:
sudo docker run hello-world
6. (Optional) Run Docker without sudo
sudo usermod -aG docker $USER
newgrp docker
# 1. Turn on and enable the socket listener so it survives reboots
sudo systemctl enable docker.socket
sudo systemctl start docker.socket
# 2. Confirm the service is resting but the socket is listening
systemctl status docker.socket
You now have Docker Engine and the Docker CLI installed on Fedora, without Docker Desktop.
After this you must need to logout the system and login again if that didn't work reboot will definately work
Thank you
Sources:
zlaam
Author
Comments (0)
You need to be logged in to post comments