Guides 11792 Published by

To install Docker CE on Rocky Linux 8 without the usual headaches, first ensure you have root or sudo privileges, disable the firewall temporarily, and remove any conflicting runtimes such as Podman. Next, add Docker’s official repository by installing the required package utilities and running the config‑manager command to point dnf at Docker’s CentOS repo, then install docker‑ce along with its CLI and containerd components. After that, enable and start the Docker service immediately, and test the installation by running a hello‑world container to confirm everything is wired up correctly. If you encounter errors such as permission denied or connection failures, check for SELinux enforcement, add your user to the docker group, or restart the service to resolve common pitfalls.



Installing Docker CE on Rocky Linux 8 – Quick & Reliable

In this guide you’ll learn how to get Docker CE up and running on Rocky Linux 8 without the usual headaches that show up when you try pulling it from a default repo.

Prerequisites and Why They Matter
  • Make sure you’re logged in as root or have sudo privileges.

Docker needs to write to system directories; without proper rights you’ll hit “permission denied” errors early on.

  • Disable the firewall temporarily (you can re‑enable it after).

The default firewalld rules block port 2375, which Docker’s REST API listens on during installation.

  • Uninstall any existing container runtimes such as Podman or buildah that might clash with Docker’s binaries.
Remove Existing Container Tools (Podman, etc.)
sudo dnf remove podman buildah -y

Rocky ships with Podman pre‑installed. If you keep it around, the docker command can point to a wrong binary or the systemd service files will conflict.

Add Docker’s Official Repository

1. Install required packages for repository handling:

   sudo dnf install -y yum-utils device-mapper-persistent-data lvm2

These tools let you create and manage the container storage pool that Docker needs.

2. Add the official Docker repo:

   sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

3. Verify the repo was added correctly by listing it:

   sudo dnf repolist | grep docker

Why this step? Rocky’s default repos don’t include Docker CE, so you have to point dnf to Docker’s own repository that contains the latest stable packages.

Install Docker CE Package
sudo dnf install -y docker-ce docker-ce-cli containerd.io
  • docker-ce is the engine.
  • docker-ce-cli provides the docker command you’ll use daily.
  • containerd.io is the low‑level runtime Docker relies on.

Skipping any of these will leave you with a broken install.

Enable and Start the Service
sudo systemctl enable docker --now

Enabling guarantees Docker starts on boot, while --now launches it immediately so you can test right away.

Verify the Installation

Run a quick hello‑world container to confirm everything is wired up:

docker run --rm hello-world

If you see a green “Hello from Docker!” message, congratulations—you’ve got a working engine.

If it stalls or shows permission errors, check that selinux isn’t enforcing a policy that blocks Docker. A quick test:

sudo setenforce 0   # temporarily switch to permissive mode
docker run --rm hello-world
setenforce 1        # revert to enforcing

I’ve seen this happen after an unexpected SELinux update on a colleague’s machine; switching to permissive resolved the issue.

Common Pitfalls & Fixes
  • “Failed to connect to the Docker daemon” – The service isn’t running. Restart it with sudo systemctl restart docker.
  • “Access denied while trying to pull an image” – Check that your user is in the docker group:
  sudo usermod -aG docker $(whoami)

Then log out and back in.

  • Package conflicts from leftover CentOS repos – Remove any stray CentOS‑based Docker repos before installing.

That’s it. You now have a clean Docker CE installation on Rocky Linux 8 ready for development, testing, or production workloads.