How to install docker in Linux

How to install docker in Linux,Docker is an open source application container engine that allows developers to package their applications, as well as dependency packages, into a portable image that can then be distributed to any popular Linux or Windows OS machine, and also virtualised. Containers are fully sandboxed using a sandbox mechanism and do not interface with each other.

Installing docker on centos

Docker is available in two versions, CE and EE. CE is the community version (free)

Uninstall the previous old version

If you have previously installed it and then want to uninstall it, use the following command

yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine \
                  docker-ce

As shown in the picture:

How to install docker in Linux

Installing docker

This step requires internet access and installation using yum

yum install -y yum-utils \
         device-mapper-persistent-data \
         lvm2 --skip-broken

As shown in the picture:
How to install docker in Linux
Update the local mirror source below

yum-config-manager \
   --add-repo \
   https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sed -i 's/download.docker.com/mirrors.aliyun.com\/docker-ce/g' /etc/yum.repos.d/docker-ce.repo

yum makecache fast

As shown in the picture:
How to install docker in Linux

Then install the CE version

yum install -y docker-ce

As shown in the picture:

How to install docker in Linux

Start docker

As docker will use many ports, it will be troublesome to release permissions one by one, so it is recommended to close the firewall directly

# Close
 systemctl stop firewalld
# Disable boot firewall
systemctl disable firewalld
# Check if the firewall is turned off
systemctl status firewalld

Then start docker with the command

# Start the docker service
systemctl start docker  
# Stop the docker service
systemctl stop docker
# Restart the docker service
systemctl restart docker

As shown in the picture:

How to install docker in Linux

How to install docker in Linux

If the launch is successful, this will be green
View docker version

docker -v

As shown in the picture:

How to install docker in Linux

Like(1)

Related

  • No articles