Docker – Install on CentOS 8

This tutorial shows how to install Docker on the Linux machine (CentOS 8). CentOS 8 uses DNF (Dandified yum) as a package manager.

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

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s