1、找一台可联网的centos7主机
在这台可以联网的机器上把离线包都下载好。
2、下载docker rpm安装包和相关依赖
## 安装yum-utils包,添加docker yum源 sudo yum install -y yum-utils sudo yum-config-manager \ --add-repo \ http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo ## 下载打包docker sudo yum install --downloadonly --downloaddir=/opt/docker-23.0 docker-ce-23.0.0-1.el7 docker-ce-cli-23.0.0-1.el7 containerd.io docker-buildx-plugin docker-compose-plugin sudo tar cf docker.tar.gz /opt/docker-23.0
3、把离线tar包上传到目标机器上解压安装
sudo tar xf docker.tar.gz sudo yum install docker/*.rpm
输出hello world 验证
下载指定版本docker,生产环境一般是有这需求
4、下载安装docker-compose
下载地址:https://github.com/docker/compose/releases/download/v2.16.0/docker-compose-linux-x86_64
上传至服务器,修改执行权限,存放路径是/usr/local/bin/docker-compose
chmod +x docker-compose-Linux-x86_64 mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose docker-compose -v
标签:compose,tar,sudo,离线,centos7,yum,docker From: https://www.cnblogs.com/ggborn-001/p/17105252.html