解压
cd /data/tools
rz docker-24.0.6.tgz docker-compose-linux-x86_64
mkdir docker-24.0.6
tar -zxvf docker-24.0.6.tgz -C docker-24.0.6
sudo cp -r docker-24.0.6/docker/* /usr/bin/
注册服务
vim /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.com
After=network.target docker.socket
[Service]
Type=notify
EnvironmentFile=-/run/flannel/docker
WorkingDirectory=/usr/local/bin
ExecStart=/usr/bin/dockerd \
-H tcp://0.0.0.0:4243 \
-H unix:///var/run/docker.sock \
--selinux-enabled=false \
--log-opt max-size=100m
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
[Install]
WantedBy=multi-user.target
## 重新加载
systemctl daemon-reload
修改存储目录
mkdir /etc/docker
vim /etc/docker/daemon.json
{
"data-root": "/data/docker/root_dir/"
}
启动
# 启动
systemctl start docker
# 设置开机自启
systemctl enable docker.service
# 没有镜像,离线无法测试安装,需要手动导入镜像测试
docker run hello-world
查看docker版本
docker version
安装docker-compose
# 1.将安装文件复制到/usr/local/bin/目录下
cp docker-compose-linux-x86_64 /usr/local/bin/docker-compose
# 2.将该文件赋为可执行文件
chmod +x /usr/local/bin/docker-compose
# 3.创建软链
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
# 4.测试是否安装成功
docker-compose -version
参考
https://www.cnblogs.com/astonc/p/17307333.html
https://blog.csdn.net/carefree2005/article/details/130616307
https://blog.csdn.net/weixin_39651041/article/details/130916908