This article records the process of installing docker on CentOS7
First confirm that our environment is centOS7
cat /etc/redhat-release
The premise is to be able to access the external network. The previous article introduced the relevant network configuration. Refer to the unclear key.
yum -y install gcc gcc-c++
To prevent interference from other versions, we first execute the command to delete the old version
yum -y remove docker docker-common docker-selinux docker-engine
We also need some necessary software environment, which can be installed as follows
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
ce is the official free version, which is enough for us to learn and use.
yum -y install docker-ce
systemctl start docker
Check the version of docker
docker version
hello-world case
docker run hello-world
Because we are directly accessing the docker hub and the server is abroad, the access will be very slow, so we need to configure the corresponding image acceleration. We choose Alibaba Cloud's image acceleration here
We can log in to Alibaba Cloud services through Taobao account or Alipay account.
Visit address: http://dev.aliyun.com/search.html
After logging in, select Console
Select Mirror Accelerator
and then select CentOS
Create docker folder
mkdir -p /etc/docker
Create the daemon.json
file
vim /etc/docker/daemon.json
Then execute the following command
systemctl daemon-reload
systemctl restart docker
Executing the hello-world
case
systemctl stop docker
yum -y remove docker-ce
rm -rf /var/lib/docker
ok~The basic installation of docker is introduced here!
Recommended Posts