CentOS7 安装Docker
参考 https://www.runoob.com/docker/centos-docker-install.html
# 先移除旧的版本: yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-selinux \ docker-engine-selinux \ docker-engine # 安装一些必要的系统工具: 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 缓存: yum makecache fast # 安装 Docker-ce: yum -y install docker-ce # 启动 Docker 后台服务 systemctl start docker service docker start # 重启 Docker 后台服务 systemctl restart docker # 查看状态 systemctl status docker systemctl status docker.service -l # 重启 service docker restart systemctl restart docker # 查看版本 docker -v
# 更换镜像源 为国内镜像源 vi /etc/docker/daemon.json # 该文件没有手动添加 # https://registry.docker-cn.com、http://hub-mirror.c.163.com、https://registry.docker-cn.com # storage-driver 存储驱动 "devicemapper" { "registry-mirrors" : ["http://hub-mirror.c.163.com"], "storage-driver": "devicemapper" } # 重启docker systemctl restart docker # 删除 Docker CE: sudo yum remove docker-ce sudo rm -rf /var/lib/docker