CentOS7中离线安装Docker与卸载
生活随笔
收集整理的這篇文章主要介紹了
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与卸载的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CentOS7中卸载Docker
- 下一篇: CentOS7中怎样修改主机名和host