日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

CentOS7中离线安装Docker与卸载

發布時間:2025/3/19 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CentOS7中离线安装Docker与卸载 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

場景

CentOS7中Docker的安裝與配置:

https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/119028701

在上面安裝Docker時,CentOS是可以訪問外網安裝的。

如果是在內網服務器上,即這臺服務器沒法訪問外網應該如何安裝Docker。

注:

博客:
https://blog.csdn.net/badao_liumang_qizhi
關注公眾號
霸道的程序猿
獲取編程相關電子書、教程推送與免費下載。

實現

首先下載docker的離線安裝包

https://download.docker.com/linux/static/stable/x86_64/

這里選擇20.10.7下載

下載之后將其上傳到服務器上某路徑下進行解壓

tar -zvxf docker-20.10.7.tgz

解壓之后將docker目錄復制到/usr/bin目錄下

cp docker/* /usr/bin/

然后新建一個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 # 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

將此文件復制到服務器上

這里是在本地Windows系統上新建文件然后使用xftp將其上傳到CentOS服務器

?

然后在服務器上將其復制到/etc/systemd/system/下

cp docker.service /etc/systemd/system/

添加文件權限

chmod +x /etc/systemd/system/docker.service

重新加載配置文件

systemctl daemon-reload

啟動docker

systemctl start docker

驗證docker版本

docker version

?卸載Docker

停止docker服務

systemctl stop docker

刪除配置文件

rm -f /etc/systemd/system/docker.service

刪除docker文件

rm -rf /usr/bin/docker*

重新加載配置文件

systemctl daemon-reload

?

總結

以上是生活随笔為你收集整理的CentOS7中离线安装Docker与卸载的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。