How to install Docker on CentOS 8

Linode Staff

Looks like CentOS 8 reaching EOL is preventing users from installing Docker as one might have expected a few years ago. Taking a look, it looks like there are several approaches one can take going forward from CentOS 8:

Has anybody had any success with any of the possible solutions? I'm wondering what might be the easiest way to just get Docker to work in my system, which is currently running CentOS 8.

Thanks in advance!

1 Reply

Hey there,

It looks like using the AlmaLinux upgrade script route is viable. I personally deployed a CentOS 8 Linode and I can see that installing Docker the regular way doesn't seem to work. But after upgrading to AlmaLinux, Installing Docker is a piece of cake.

Here are the steps I took with my root user account:

Download and run the AlmaLinux upgrade script:

curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh

sudo bash almalinux-deploy.sh

Reboot my system:

reboot now

Add Docker CE repository:

dnf install -y yum-utils

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

Install Docker CE for AlmaLinux 8:

dnf -y install docker-ce docker-ce-cli containerd.io

systemctl enable --now docker

Add Docker to my user group (in my case 'root'):

usermod -aG docker root

newgrp docker

After that, I verified I can use Docker and that my Docker process is running as expected like this:

docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete 
Digest: sha256:97a379f4f88575512824f3b352bc03cd75e239179eea0fecc38e597b2209f49a
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

ps aux |grep -i [d]ocker
root        7533  0.1 10.4 1443188 86508 ?       Ssl  21:38   0:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

docker ps -a
CONTAINER ID   IMAGE         COMMAND    CREATED          STATUS                      PORTS     NAMES
984e4a63e45e   hello-world   "/hello"   15 minutes ago   Exited (0) 15 minutes ago             sad_villani

Cheers!
Arty

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct