CentOS7.9安装Docker
1、安装需要的软件包, yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的
yum install -y yum-utils device-mapper-persistent-data lvm2
2、设置yum源(选择其中一个)
1. yum-config-manager --add-repo http://download.docker.com/linux/centos/docker-ce.repo(中央仓库) 2. yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo(阿里仓库)
3、安装(开源社区版本)
yum -y install docker-ce
4、启动docker并加入开机启动
1.systemctl start docker 2.systemctl enable docker
5、查看安装的版本
docker version
6、测试hello-world(需要FQ,可能会拉取不下来)
docker pull hello-world
7、运行hello-world
docker run hello-world
8、编辑 /etc/docker/daemon.json (如果以下地址失效请自行找有效地址)
vim /etc/docker/daemon.json
{ "registry-mirrors": [ "https://docker.m.daocloud.io", "https://dockerproxy.com", "https://docker.mirrors.ustc.edu.cn", "https://docker.nju.edu.cn", "https://docker-proxy.741001.xyz", "https://registry.docker-cn.com" ] }
9、重新加载配置,并重新启动docker,再次拉取hello-world即可
1. systemctl daemon-reload 2. systemctl restart docker

浙公网安备 33010602011771号