This tutorial shows how to install Docker on the Linux machine (CentOS 8). CentOS 8 uses DNF (Dandified yum) as a package manager.
- GitHub link to the instruction
Check OS
cat /etc/redhat-release
Switch User to super user
sudo su
Update the System
dnf check-update
dnf upgrade -y
Add Docker Repository
dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
dnf repolist
Install Docker
dnf install docker-ce --nobest --allowerasing -y
- The options will resolve dependencies.
Add a user to the docker group
usermod -a -G docker user_name
exit
docker version
- To make a user to access docker, you need to log out and log in again.
Start Docker
sudo systemctl enable docker
systemctl status docker
sudo systemctl start docker
systemctl status docker
docker image ls
Run a Image and Check the container
docker container run hello-world
docker image ls
docker container ls -a
docker container ps -a
docker container inspect 9c3efb538960
docker container rm 9c3efb538960
docker container ls -a
docker image rm hello-world
docker image ls
Stop Docker
sudo systemctl stop docker