centos7 離線(內網環境無外網) 安裝docker
阿新 • • 發佈:2022-12-05
1. 環境
1. centos 7 內網環境 無外網連線,yum安裝會失效,採用離線安裝包方式安裝docker
2. 下載安裝包
1. 百度網盤:
連結:https://pan.baidu.com/s/1ArPt-NhjtdKTBW3I4BE-iQ
提取碼:ngyh
2. 採用的是docker-19.03.9 這個版本
3. 安裝指令碼
#!/bin/sh #author 明知山有小腦斧<12345ssdlh.xyz> #describe docker安裝指令碼 # 解壓docker檔案 tar -zxvf docker-19.03.9.tgz # 將docker目錄移到/usr/bin目錄下... mv docker/* /usr/bin/ # 寫入docker 配置檔案 cat >> /etc/systemd/system/docker.service<< EOF [Unit] Description=Docker Application Container Engine Documentation=https://docs.docker.com After=network-online.target firewalld.service Wants=network-online.target [Service] Type=notify # the default is not to use systemd for cgroups because the delegate issues still # exists and systemd currently does not support the cgroup feature set required # for containers run by docker ExecStart=/usr/bin/dockerd ExecReload=/bin/kill -s HUP \$MAINPID # Having non-zero Limit*s causes performance problems due to accounting overhead # in the kernel. We recommend using cgroups to do container-local accounting. LimitNOFILE=infinity LimitNPROC=infinity LimitCORE=infinity # Uncomment TasksMax if your systemd version supports it. # Only systemd 226 and above support this version. #TasksMax=infinity TimeoutStartSec=0 # set delegate yes so that systemd does not reset the cgroups of docker containers Delegate=yes # kill only the docker process, not all processes in the cgroup KillMode=process # restart the docker process if it exits prematurely Restart=on-failure StartLimitBurst=3 StartLimitInterval=60s [Install] WantedBy=multi-user.target EOF # 新增檔案許可權 chmod 755 /etc/systemd/system/docker.service # 重新載入配置檔案 systemctl daemon-reload # 啟動docker systemctl start docker # 設定開機自啟動 systemctl enable docker.service # 刪除docker 解壓檔案 rm -rf ./docker sleep 1 clear
把安裝指令碼複製到安裝包同一路徑下,儲存為docker.sh 檔案
賦予docker.sh 執行許可權
chmod 755 docker.sh
4. 安裝
執行docker安裝命令
sh docker.sh
等待安裝完成
5. 測試安裝
docker ps -a
docker info
docker -v
docker images
上述命令挨個執行一遍,看看控制檯是否有輸出,有輸出證明安裝成功