Linux: Installing Docker Community Edition on Centos 8

# Switch into Sudo mode
sudo su

# Disable the built-in firewall as it will block DNS resolution inside Docker
sudo systemctl disable firewalld

# Add Docker Repo
sudo dnf config-manager --add-repo=

# Manually install the dependency
# Check this URL for the latest version of containerd:
sudo dnf install $containerdSource -y
sudo dnf install docker-ce docker-ce-cli -y

# Start Docker at bootup
systemctl start docker
sudo systemctl enable --now docker
systemctl is-enabled docker

# Adding a user into the docker group to allow execution of docker commands
# adduser will create user, group with same name, and create home directory in one command
sudo adduser $user -g docker
sudo passwd $user
sudo usermod -aG docker $user

# Optional add user to wheel group to allow 'sudo su' privilege elevation
sudo gpasswd -a $user wheel

# Validate
id  $user

# Alternative validation command
[root@server01 ~]# sudo lid -g docker

# Sample output
root@server01 ~]# id $user
uid=1003(elephant) gid=986(docker) groups=986(docker)

Some possible errors and explanations:

# Normal commands to install Docker with the --nobest switch to ensure that compatible versions are selected
dnf install docker-ce --nobest -y

# Unfortunately Cento 8 currently blocks
[root@server01 ~]# dnf install docker-ce --nobest -y
Last metadata expiration check: 0:01:00 ago on Fri 21 Feb 2020 02:03:18 PM PST.
Dependencies resolved.
Problem: package docker-ce-3:19.03.6-3.el7.x86_64 requires >= 1.2.2-3, but none of the providers can be installed
- cannot install the best candidate for the job
- package is excluded
- package is excluded
- package is excluded
- package is excluded
- package is excluded
- package is excluded
# Output of a successful Docker-CE install
[root@server01 ~]# sudo dnf install docker-ce docker-ce-cli -y
Last metadata expiration check: 0:13:19 ago on Fri 21 Feb 2020 02:03:18 PM PST.
Package docker-ce-3:18.09.1-3.el7.x86_64 is already installed.
Package docker-ce-cli-1:19.03.6-3.el7.x86_64 is already installed.
Dependencies resolved.
Package Architecture Version Repository Size
docker-ce x86_64 3:19.03.6-3.el7 docker-ce-stable 24 M

Transaction Summary
Upgrade 1 Package

Total download size: 24 M
Downloading Packages:
docker-ce-19.03.6-3.el7.x86_64.rpm 19 MB/s | 24 MB 00:01
Total 19 MB/s | 24 MB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: docker-ce-3:19.03.6-3.el7.x86_64 1/1
Upgrading : docker-ce-3:19.03.6-3.el7.x86_64 1/2
Running scriptlet: docker-ce-3:19.03.6-3.el7.x86_64 1/2
Running scriptlet: docker-ce-3:18.09.1-3.el7.x86_64 2/2
/usr/bin/dockerd has not been configured as an alternative for dockerd

Cleanup : docker-ce-3:18.09.1-3.el7.x86_64 2/2
Running scriptlet: docker-ce-3:18.09.1-3.el7.x86_64 2/2
Verifying : docker-ce-3:19.03.6-3.el7.x86_64 1/2
Verifying : docker-ce-3:18.09.1-3.el7.x86_64 2/2


Posted on Categories Linux

Leave a Reply

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