下载docker相关rpm包进行安装
- 下载地址: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/
- 下载安装所需的包至同一目录:
containerd.io-1.6.9-3.1.el7.x86_64.rpm
docker-ce-cli-20.10.21-3.el7.x86_64.rpm
docker-ce-20.10.21-3.el7.x86_64.rpm
docker-ce-rootless-extras-20.10.21-3.el7.x86_64.rpm
docker-scan-plugin-0.21.0-3.el7.x86_64.rpm
docker-compose-plugin-2.12.2-3.el7.x86_64.rpm (安装docker compose) - 安装所有的包:
yum install *.rpm
(必须同时安装所有的包,不然会出现包之间相互依赖的问题)
修改docker的镜像地址
vim /etc/docker/daemon.json
{ "registry-mirrors": ["https://mirror.baidubce.com","https://hub-mirror.c.163.com","https://ustc-edu-cn.mirror.aliyuncs.com"] }
修改docker默认存储路径
修改路径:
vim /usr/lib/systemd/system/docker.service
ExecStart后添加--graph=/YourPath
如果默认路径下有需要的数据则需要先把数据移动到新的路径下:mv /var/lib/docker /YourPath
重启docker:
systemctl daemon-reload
systemctl restart docker
查看docker信息:
docker info