Docker – Install on CentOS 7

This tutorial shows how to install Docker on the Linux machine (CentOS 7).

Check OS

cat /etc/redhat-release

Switch User to super user

sudo su

Update the System

yum update -y
yum install -y yum-utils
yum install -y device-mapper-persistent-data
yum install -y lvm2

Add Docker Repository

yum-config-manager --add-repo
yum repolist

Install Docker

yum install -y docker-ce

Add a user to the docker group

usermod -a -G docker user_name
docker version
  • To make a user to access docker, you need to log out and log in again.

Start Docker

sudo systemctl enable docker
sudo systemctl start 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 d9605d9e14f0
docker container rm d9605d9e14f0
docker container ls -a
docker image rm hello-world
docker image ls

Stop Docker

sudo systemctl stop docker

Uninstall Docker

sudo yum remove -y docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \

Leave a Comment

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

You are commenting using your 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