溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Centos7如何離線安裝Docker

發(fā)布時間:2021-06-12 12:26:25 來源:億速云 閱讀:745 作者:小新 欄目:云計算

這篇文章將為大家詳細講解有關Centos7如何離線安裝Docker,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。

下載Docker并安裝

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/

#進入data目錄,解壓docker包
cd /data
tar -zxvf docker-20.10.0.tgz

#將解壓出來的docker文件內容移動到 /usr/bin/ 目錄下
cp docker/* /usr/bin/

#查看docker版本
docker version

#查看docker信息
docker info

配置Docker開機自啟動服務

#添加docker.service文件
vi /etc/systemd/system/docker.service
#按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í)行權限
chmod +x /etc/systemd/system/docker.service

#重新加載配置文件
systemctl daemon-reload

#啟動Docker
systemctl start docker

#查看docker啟動狀態(tài)
systemctl status docker

#查看啟動容器
docker ps

#設置開機自啟動
systemctl enable docker.service

#查看docker開機啟動狀態(tài) enabled:開啟, disabled:關閉
systemctl is-enabled docker.service

關于“Centos7如何離線安裝Docker”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,使各位可以學到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI