(1) yum update to the latest package
yum update
(2) require installation package, yum-util provide yum-config-manager function, the other two are driven dependent devicemapper
yum install -y yum-utils device-mapper-persistent-data lvm2
Set yum source cloud Ali
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
(4) mounted docker
yum install docker-ce
After you install version View docker
docker -v
2.2 Set mirror ustc
ustc is a veteran of linux mirror service provider, and as far in ubuntu 5.04 version when in use. docker Mirror accelerator speed ustc quickly. One of the advantages ustc docker mirror is no need to register, is a real public service.
[https://lug.ustc.edu.cn/wiki/mirrors/help/docker](https://lug.ustc.edu.cn/wiki/mirrors/help/docker)
Edit the file: vi /etc/docker/daemon.json
Enter the following in the file:
```
{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]
}
```
2.3 Docker start and stop
Start docker: systemctl start docker
停止docker : systemctl stop docker
Restart docker: systemctl restart docker
查看docker状态:systemctl status docker
开机启动:systemctl enable docker
查看docker概述信息:docker info
查看docker帮助文档:docker --help
3 常用命令
查看镜像
docker images
TAG:镜像标签
IMAGE ID:镜像ID
CREATED:镜像的创建日期(不是获取该镜像的日期)
SIZE:镜像大小
这些镜像都是存储在Docker宿主机的/var/lib/docker目录下
搜索镜像
docker search 镜像名称
3.1.3 拉取镜像
docker pull 镜像
拉取镜像就是从中央仓库中下载镜像到本地
docker pull centos:7
3.1.4 删除镜像docker rmi 镜像ID
docker rmi `docker images -q`