使用二进制方式安装步骤如下:
#下载二进制离线压缩包
wget https://download.docker.com/linux/static/stable/x86_64/docker-20.10.18.tgz
#解压文件
tar -zxvf docker-20.10.18.tgz
chmod +x docker/*
#将二进制文件拷贝到/usr/bin/
cp docker/* /usr/bin/
#注册到系统服务
vim /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
#指定docker存储目录/MYAPP/docker/lib
ExecStart=/usr/bin/dockerd --graph /MYAPP/docker/lib
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
asksMax=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
#重载
mkdir -p /MYAPP/docker/lib
systemctl daemon-reload
#启动服务并加入开机启动
systemctl start docker && systemctl enable docker
#检查
systemctl status docker
##docker-compose安装
上传docker-compose二进制文件到服务器
mv docker-compose /usr/bin/
chmod +x /usr/bin/docker-compose
#验证
docker-compose version
安装docker客户端buildx插件:
1. 下载二进制包
https://github.com/docker/buildx/releases/download/v0.9.1/buildx-v0.9.1.linux-amd64
2. 给文件改名和赋权,放到目标目录中
mv buildx-v0.9.1.linux-amd64 docker-buildx && chmod +x docker-buildx
mv docker-buildx $HOME/.docker/cli-plugins/
3.验证
docker buildx version
官方文档:
https://github.com/docker/buildx#linux-packages