Install using the repository
SET UP THE REPOSITORY
1.Install required packages. yum-utils provides the yum-config-manager utility, and device-mapper-persistent-data and lvm2 are required by the devicemapper storage driver.
$ sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
2.Use the following command to set up the stable repository.
$ sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
INSTALL DOCKER CE
$ sudo yum install docker-ce
Start Docker
$ sudo systemctl start docker
3.Verify that Docker CE is installed correctly by running the hello-world image.
$ sudo docker run hello-world
更换镜像源
进入目录
cd /etc/docker
编辑文件
vim daemon.json
添加源
{
"registry-mirrors": ["https://mj9kvemk.mirror.aliyuncs.com"]
}
重启docker
service docker restart