centOS7.3 離線安裝docker

一、環境

 因某些環境,不能聯外網,所以使用docker yum源方法行不通,於是打算離線安裝

 環境:contos7.3(內核需爲3.10+)

cat /etc/redhat-release
# CentOS Linux release 7.3.1611 (Core)

 下載:docker-18.06.3-ce.tar

 

二、安裝步驟

 1)setup

cd /usr/local/resource/docker
tar -xzvf docker-18.06.3-ce.tar
mv  /usr/local/resource/docker/docker/*  /usr/bin/ # 將二進制文件移動到bin下

  2)systemd docker.service

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

  然後:

systemctl daemon-reload   # 重載systemd下 xxx.service文件
systemctl start docker       # 啓動Docker
systemctl enable docker.service   # 設置開機自啓

  測試是否成功:

systemctl status docker   # 查看Docker狀態
docker -v # 查看Docker版本

  

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章