docker及docker-compose离线安装
参考
https://blog.csdn.net/linmengmeng_1314/article/details/135653694
docker
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
#系统架构
uname -p
x86_64
uanme -a
#下载对应架构的docker
#https://download.docker.com/linux/static/stable/
#以docker-20.10.6.tgz为例,上传至/opt/docker-pkg目录
cd /opt/docker-pkg
tar -zxvf docker-20.10.6.tgz
mv docker/* /usr/bin/
#此时docker尚未启动,查看docker版本
docker -v
Docker version 20.10.6, build 370c289
docker version
docker info
#测试docker启动后
dockerd
#关闭测试启动
Ctrl+c
#docker服务由systemd接管
vi /usr/lib/systemd/system/docker.service
#/usr/lib/systemd/system/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
#docker.service添加执行权限
chmod +x /usr/lib/systemd/system/docker.service
#编辑daemon.json
vi /etc/docker/daemon.json
#/etc/docker/daemon.json文本内容如下
{
"registry-mirrors": ["https://registry.docker-cn.com"],
"exec-opts": ["native.cgroupdriver=systemd"]
}
#加载服务配置文件
systemctl daemon-reload
#启动
systemctl start docker
docker info
#开机启动
systemctl enable docker
docker-compose
#下载地址https://github.com/docker/compose/releases
#下载对应架构的,以v2.24.0为例docker-compose-linux-x86_64
#切换到安装包文件所在目录
cp docker-compose-linux-aarch64 /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose -v
Docker Compose version v2.24.0
标签:systemd,compose,service,离线,usr,https,docker
From: https://www.cnblogs.com/sung1024/p/18207915