[root@localhost ~]# yum -y update
[root@localhost ~]# yum -y install yum-utils device-mapper-persistent-data lvm2
[root@localhost ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo # 官方 [root@localhost ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo # 阿里云
[root@localhost ~]# yum -y install docker-ce docker-ce-cli containerd.io
[root@localhost ~]# systemctl start docker # 启动 [root@localhost ~]# systemctl restart docker # 重启 [root@localhost ~]# systemctl status docker # 状态 [root@localhost ~]# systemctl stop docker # 停止 [root@localhost ~]# systemctl enable docker # 设置开机自启
[root@localhost ~]# docker version
使用加速器可以提升获取Docker官方镜像的速度
登录阿里云获取加速地址 https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors
Linux中配置加速地址
[root@localhost ~]# vim /etc/docker/daemon.json [root@localhost ~]# systemctl daemon-reload # 重启daemon [root@localhost ~]# systemctl restart docker # 重启docker
{ "registry-mirrors": ["https://o7h0exrr.mirror.aliyuncs.com"] }
[root@localhost ~]# docker --help # 查看帮助文档 [root@localhost ~]# docker info # 查看概要信息 [root@localhost ~]# docker images # 查看本地镜像