简介
如果你的服务器无法连接外网,可以使用离线包来安装docker和启动容器,官方文档:https://docs.docker.com/engine/install/centos/#install-from-a-package
安装
shell
sudo yum install containerd.io-1.6.28-3.2.el7.x86_64.rpm docker-ce-25.0.4-1.el7.x86_64.rpm docker-ce-cli-25.0.4-1.el7.x86_64.rpm docker-ce-rootless-extras-25.0.4-1.el7.x86_64.rpm docker-buildx-plugin-0.13.0-1.el7.x86_64.rpm docker-compose-plugin-2.6.0-3.el7.x86_64.rpm
sudo systemctl start docker
#verify
yum list installed | grep docker
sudo docker run hello-world
镜像导出与导入
shell
docker pull <imageId:tag>
docker save -o <imageId>-<tag>.tar <imageId:tag>
# import
docker load -i <imageId>-<tag>.tar
容器镜像站:https://dockerproxy.com/