下载二进制包
wget https://download.docker.com/linux/static/stable/x86_64/docker-20.10.9.tgz
解压
tar xvf docker-20.10.9.tgz
会出现一个docker目录,把里面的二进制文件移动到/usr/bin/下
mv docker/* /usr/bin/
配置环境变量:
echo "export PATH=/usr/bin/:$PATH" >> /etc/profile
source /etc/profile
docker启动脚本
vim /etc/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
##--graph /soft/docker/data 指定docker数据存储目录
[Service]
Type=notify
ExecStart=/usr/bin/dockerd --graph /soft/docker/data -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
启动
systemctl daemon-reload
systemctl enable docker.service
systemctl start docker
systemctl status docker