關(guān)于CentOS 8.4離線安裝Docker包的問題
用的CentOS 8.4的虛擬機,模擬的服務(wù)器環(huán)境,無法連接外網(wǎng),只能離線安裝軟件。
首先通過外網(wǎng)機下載Docker安裝包,下載地址:
Index of linux/static/stable/x86_64/
https://download.docker.com/linux/static/stable/x86_64/
大家可以根據(jù)自己的需要下載相應(yīng)的版本,我下載的是20.10.8。
解壓文件包:
tar zxvf docker-20.10.8.tgz
得到docker文件夾,進入到該文件夾,可以看到有如下這些文件:

為了讓docker命令可在任何位置執(zhí)行,需要將以上這些文件移動到系統(tǒng)可執(zhí)行目錄,比如/usr/bin目錄;或者將當(dāng)前目錄添加到環(huán)境變量中。此處,我們用第一種方式。
cp * /usr/bin/
可選擇不覆蓋runc。
到此,已經(jīng)可以執(zhí)行docker命令了,如下命令可查看docker的版本信息。

進一步地,為了便于對docker進行管理,我們需要配置docker service。在/etc/systemd/system目錄下創(chuàng)建docker.service文件,文件內(nèi)容如下:
[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 -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock 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
為docker.service增加可執(zhí)行權(quán)限:
chmod +x /etc/systemd/system/docker.service
重新加載服務(wù)配置文件:
systemctl daemon-reload
重啟docker:
systemctl restart docker
使能開機自啟動:
systemctl enable docker
查看docker狀態(tài):
systemctl status docker

到此這篇關(guān)于CentOS 8.4離線安裝Docker的文章就介紹到這了,更多相關(guān)CentOS離線安裝Docker內(nèi)容請搜索本站以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持本站!
版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非maisonbaluchon.cn所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。
關(guān)注官方微信