Install
I have moved my systems to Rocky Linux 8 and also have some Red Hat 8 builds. So these instructions will use the package manager that comes with those operating systems. You may have to tweak these commands to fit your package manager, if not using the same style systems. However, the simplicity of it should still be the same.
Install The Docker Repository (Docker Documentation)
dnf -y config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Update The System
I usually build a system using the bare minimums, so I am also going to add a couple items before just going for it.
# Update the entire system (which will also bring in the new Docker repo)
dnf -y update
# I need to add iptables to my system so Docker can use it to make it's own internal networks
# avaialbe to the operating system (so I can access them). "lsof" is a handy tool, so I am
# including it.
dnf -y install lsof iptables iptables-services iptables-utils
Install Docker
This is the super hard part.
# This will install the Docker Community Edition Engine and CLI.
# I am also including the Docker Compose Plugin and ContainerD.io
dnf -y install docker-ce docker-ce-cli docker-compose-plugin containerd.io
Enable and Start Docker
systemctl enable --now docker
That's it.
Docker is installed and ready to use!
Here is all of the above in a nice copy/paste string. (It's me, not you.) ;)
dnf -y config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo && \
dnf -y update && \
dnf -y install lsof iptables iptables-services iptables-utils && \
dnf -y install docker-ce docker-ce-cli docker-compose-plugin containerd.io && \
systemctl enable --now docker