下载docker二进制版本
请选择最新最稳定的CE版本
https://download.docker.com/linux/static/stable/x86_64/
例如 :下载版本为docker-26.1.4.tgz的docker二进制压缩包到 tools目录下:
wget https://download.docker.com/linux/static/stable/x86_64/docker-26.1.4.tgz
解压出二进制文件
解压出的一个文件目录为 docker/
tar -xvf docker-26.1.4.tgz
复制二进制文件到/usr/bin目录下
cp docker/* /usr/bin/
检查docker命令是否可用
docker --version
配置systemctl 启动命令并设置开机启动
创建 /usr/lib/systemd/system/docker.service
文件
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
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
采用 systemctl 设置自动重启
systemctl daemon-reload
systemctl start docker.service
#设置开机自动启动
systemctl enable docker
验证docker 是完成安装
docker ps
docker-compose 安装
下载地址:https://github.com/docker/compose/tags
wget https://github.com/docker/compose/releases/download/v2.27.1/docker-compose-linux-x86_64 >/usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
测试是否安装成功
docker-compose version
评论