Install Docker on CentOS 8 – Automatically!

Docker doesn’t come with “stock” repos on CentOS, some variations of alias programs are installations like podman.

These lack many of the core commands of the “real” Docker.

Here is a guide to install Docker Latest Version on CentOS.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
yum clean all -y
yum update -y
yum upgrade -y

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

DOCKERVERSION=$(dnf list docker-ce --showduplicates | \
sort -r | \
grep "docker-ce.x86_64" -m1 | \
sed -e 's/docker\-ce\.x86\_64//g' -e 's/docker\-ce\-stable//g' | \
tr -d [:space:])

echo "Installing docker-ce-$DOCKERVERSION"

# remove this line in auto environments
read -p "Does this look right? Ctrl C to stop."

dnf install containerd -y

dnf install docker-ce-$DOCKERVERSION -y

# if the above fails, try the latest compatible via
dnf --nobest install docker-ce-$DOCKERVERSION --nobest -y

Leave a Reply

Your email address will not be published. Required fields are marked *