CentOS離線安裝docker


准備文件

1. docker-19.03.0.tgz  下載地址:https://download.docker.com/linux/static/stable/x86_64/

 

一、解壓

tar -zxvf docker-19.03.0.tgz

二、創建docker.service

vim /etc/systemd/system/docker/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 -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

三、授權執行權限

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

四、重載systemd下xxx.service文件

systemctl daemon-reload

五、安裝完成,啟動Docker

# 啟動docker
systemctl start docker
# 設置開機啟動
systemctl enable docker
# 查看docker狀態
systemctl status docker
# 查看docker版本
docker -v

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM