Docker – Install on Linux

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

Check OS

cat /etc/redhat-release

Switch User to root

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 https://download.docker.com/linux/centos/docker-ce.repo
 
yum repolist

Install Docker

yum install -y docker-ce

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
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 rmi hello-world
docker image ls

Stop Docker

sudo systemctl stop docker

Leave a Reply

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 )

Google photo

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