内网安装docker
<h2>1 docker下载</h2>
<p>转到 <a href="https://download.docker.com/linux/static/stable/">https://download.docker.com/linux/static/stable/</a> (或更改stable为edge或test),选择您的硬件平台,然后下载.tgz与要安装的Docker CE版本相关的文件。</p>
<h2>2 安装过程</h2>
<ol>
<li>在需要安装docker的机器上创建合适的文件夹存放下载的docker文件;</li>
<li>通过命令 <code>tar -xvf docker-18.06.1-ce.tgz</code>来解压文件;</li>
<li>通过命令 <code>cp docker/* /usr/bin</code>将解压好的包复制到/usr/bin目录下;</li>
<li>
<p>编辑文件 将Docker注册为服务 <code>vim /etc/systemd/system/docker.service</code>,文件内容如下:</p>
<pre><code>[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
</code></pre>
</li>
<li>给服务添加权限 <code>chmod 754 /etc/systemd/system/docker.service</code>;</li>
<li>重新加载服务文件 <code>systemctl daemon-reload</code>;</li>
<li>启动docker服务 <code>systemctl start docker</code>;</li>
<li>设置开机自启 <code>systemctl enable docker.service</code>;</li>
</ol>
<p>安装完毕!</p>
<p><a href="https://www.baidu.com">百度一下!</a></p>