這篇文章將為大家詳細(xì)講解有關(guān)Centos7如何離線安裝Docker,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
創(chuàng)新互聯(lián)"三網(wǎng)合一"的企業(yè)建站思路。企業(yè)可建設(shè)擁有電腦版、微信版、手機(jī)版的企業(yè)網(wǎng)站。實(shí)現(xiàn)跨屏營銷,產(chǎn)品發(fā)布一步更新,電腦網(wǎng)絡(luò)+移動(dòng)網(wǎng)絡(luò)一網(wǎng)打盡,滿足企業(yè)的營銷需求!創(chuàng)新互聯(lián)具備承接各種類型的成都做網(wǎng)站、網(wǎng)站制作項(xiàng)目的能力。經(jīng)過十多年的努力的開拓,為不同行業(yè)的企事業(yè)單位提供了優(yōu)質(zhì)的服務(wù),并獲得了客戶的一致好評。
docker包下載地址
#下載docker-20.10.0包 https://download.docker.com/linux/static/stable/x86_64/docker-20.10.0.tgz #上傳到Centos系統(tǒng)/data/目錄,如 scp docker-20.10.0.tgz root@192.168.0.5:/data/ #進(jìn)入data目錄,解壓docker包 cd /data tar -zxvf docker-20.10.0.tgz #將解壓出來的docker文件內(nèi)容移動(dòng)到 /usr/bin/ 目錄下 cp docker/* /usr/bin/ #查看docker版本 docker version #查看docker信息 docker info
#添加docker.service文件 vi /etc/systemd/system/docker.service #按i插入模式,復(fù)制如下內(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 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
#添加文件可執(zhí)行權(quán)限 chmod +x /etc/systemd/system/docker.service #重新加載配置文件 systemctl daemon-reload #啟動(dòng)Docker systemctl start docker #查看docker啟動(dòng)狀態(tài) systemctl status docker #查看啟動(dòng)容器 docker ps #設(shè)置開機(jī)自啟動(dòng) systemctl enable docker.service #查看docker開機(jī)啟動(dòng)狀態(tài) enabled:開啟, disabled:關(guān)閉 systemctl is-enabled docker.service
關(guān)于“Centos7如何離線安裝Docker”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學(xué)到更多知識,如果覺得文章不錯(cuò),請把它分享出去讓更多的人看到。