码迷,mamicode.com
首页 > 其他好文 > 详细

centOS7.3 离线安装docker

时间:2019-12-27 11:44:53      阅读:73      评论:0      收藏:0      [点我收藏+]

标签:cgroup   inter   def   table   exist   nload   外网   efault   mat   

一、环境

 因某些环境,不能联外网,所以使用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版本

  

centOS7.3 离线安装docker

标签:cgroup   inter   def   table   exist   nload   外网   efault   mat   

原文地址:https://www.cnblogs.com/always-fight/p/11474872.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!