RHEL 8 comes with its own implementation of a container runtime based on Red Hat's libpod container management library. So this means that Docker is not the only game in town at this point.
The new tools are called Podman and Buildah. They run with the help of runc. Podman is used to manage pods and container images. Buildah is used for building container images. Runc is a universal container runtime CLI tool used for creating and running containers. Runc builds upon libcontainer
Here we are going to install Docker-CE (Community Edition) on RHEL 8. Why you must ask?
I don't know...
Maybe because I can.
Or maybe because your organization wants to keep compatibility between various Linux flavors where Podman may not be available. It shouldn't matter since Podman is supposed to be compatible with Docker, but I've seen stranger nonsensical things done at orgs so nothing phases me anymore.
Getting to the meat of things
We start off by enabling the Docker-CE repository in DNF. DNF is YUM replacement in RHEL 8 / CentOS 8 / Fedora version WHATEVER.
$ sudo dnf config-manager --add-repo=https://docker.download.com/linux/centos/docker-ce.repo
$ sudo dnf install -y docker-ce
Enable Docker Engine:
$ sudo systemctl enable docker $ sudo systemctl start docker $ sudo systemctl is-active docker
Add your user to the docker group in /etc/groups. THis will let you interface with the docker daemon.
Now don't just blindly add your user to various Linux groups. Try to understand what you are doing using this command and if you are working on some org's systems, please complain to their security standards!
If you are using BASH shell, $USER will be filled in from your environment variables.
$ sudo usermod -G docker -a $USER
Run a container to test things out. We will perform an operation in that container that checks to see if it's a container.
$ docker pull centos $ docker run -ti centos:latest /bin/bash -c "stat .dockerenv" File: .dockerenv Size: 0 Blocks: 0 IO Block: 4096 regular empty file Device: 89h/137d Inode: 18417292 Links: 1 Access: (0755/-rwxr-xr-x) Uid: ( 0/ root ) Gid: ( 0/ root ) Access: 2020-11-29 22:22:48.651882505 +0000 Modify: 2020-11-29 22:22:48.651882505 +0000 Change: 2020-11-29 22:22:48.651882505 +0000 Birth: -