Docker 官网离线安装文档:Install Docker Engine from binaries
整理步骤如下:
1.去官网下载 docker 安装包,地址为:https://download.docker.com/linux/static/stable/x86_64/;
2.解压;
3.移到 /usr/bin;
4.后台运行;
#官网下载 docker 安装包
wget https://download.docker.com/linux/static/stable/x86_64/docker-20.10.22.tgz
#解压
tar -zxvf docker-20.10.22.tgz
#移动到/usr/bin目录
sudo cp docker/* /usr/bin/
# 在后台运行
sudo nohup dockerd &
docker run hello-world
1).去 https://github.com/docker/compose/releases 下载 docker-compose;(v2.20.0)
2).移动到 /usr/local/bin/docker-compose;
3).添加执行权限;
4).查看版本;
sudo mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose -v
# 删除 docker
sudo rm -rf /usr/bin/docker*
# 删除 containerd
sudo rm -rf /usr/bin/containerd*
# 删除 docker 运行时 ID
sudo rm -rf /var/run/docker*
# 卸载 docker-compose
sudo rm -rf /usr/local/bin/docker-compose
sudo rm -rf /var/lib/docker*
sudo rm -rf /var/lib/containerd*
1)、执行“vim /etc/systemd/system/docker.service
”命令,然后在文件中添加以下内容,退出并保存。
下面的配置需要注意的是 : ExecStart=/usr/bin/dockerd,也就是说指明了dockerd所在位置。
[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
2)、给文件增加可执行权限
chmod +x /etc/systemd/system/docker.service
systemctl daemon-reload
3)、?设置开机自启动
systemctl enable docker.service
4)、启动docker
systemctl start docker
5)、测试docker是否启动
docker version