一、docker环境离线部署
1.下载docker安装包并上传linux服务器
Index of linux/static/stable/x86_64/
2.解压安装包
tar -xvf docker-24.0.0.tgz
3.将解压出来的docker文件内容移动到 /usr/bin/ 目录下
#移动命令 复制命令请用cp
mv docker/* /usr/bin/
4.将docker注册为service服务
vi /etc/systemd/system/docker.service
docker.service 编辑的内容
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
5.启动docker
chmod +x /etc/systemd/system/docker.service #设置权限
systemctl daemon-reload
systemctl start docker #启动Docker
systemctl enable docker.service #设置开机自启
6.验证
systemctl status docker #查看Docker状态
docker -v #查看Docker版本
二、docker-compose 环境离线部署
1.下载离线包
Tags · docker/compose · GitHub
2.复制文件到指定目录并给文件添加执行权限
mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
3.验证安装是否成功
docker-compose -v