Linux下离线安装Docker 港控/mmm° 2021-12-11 17:29 385阅读 0赞 ## Linux下离线安装Docker ## ### 一、基础环境 ### 1、操作系统:CentOS 7.3 **2****、****Docker****版本:****18.06.1 **[**官方下载地址(打不开可能需要\*\*\*)**][Link 1] 3、百度云Docker 18.06.1地址:[**https://pan.baidu.com/s/1YdN9z72QutPkHBfLq06H1A**][https_pan.baidu.com_s_1YdN9z72QutPkHBfLq06H1A] 密码:dvvh **4****、官方参考文档:**[**https://docs.docker.com/install/linux/docker-ce/binaries/\#install-static-binaries**][https_docs.docker.com_install_linux_docker-ce_binaries_install-static-binaries] ### 二、Docker安装 ### 1、解压 tar -xvf docker-18.06.1-ce.tgz 2、将解压出来的docker文件内容移动到 /usr/bin/ 目录下 cp docker/\* /usr/bin/ 3、将docker注册为service vim /etc/systemd/system/docker.service 将下列配置加到docker.service中并保存 <table> <tbody> <tr> <td style="vertical-align:top;"> <p><strong>[Unit]</strong></p> <p><strong>Description=Docker Application Container Engine</strong></p> <p><strong>Documentation=https://docs.docker.com</strong></p> <p><strong>After=network-online.target firewalld.service</strong></p> <p><strong>Wants=network-online.target</strong></p> <p><strong>[Service]</strong></p> <p><strong>Type=notify</strong></p> <p><strong># the default is not to use systemd for cgroups because the delegate issues still</strong></p> <p><strong># exists and systemd currently does not support the cgroup feature set required</strong></p> <p><strong># for containers run by docker</strong></p> <p><strong>ExecStart=/usr/bin/dockerd</strong></p> <p><strong>ExecReload=/bin/kill -s HUP $MAINPID</strong></p> <p><strong># Having non-zero Limit*s causes performance problems due to accounting overhead</strong></p> <p><strong># in the kernel. We recommend using cgroups to do container-local accounting.</strong></p> <p><strong>LimitNOFILE=infinity</strong></p> <p><strong>LimitNPROC=infinity</strong></p> <p><strong>LimitCORE=infinity</strong></p> <p><strong># Uncomment TasksMax if your systemd version supports it.</strong></p> <p><strong># Only systemd 226 and above support this version.</strong></p> <p><strong>#TasksMax=infinity</strong></p> <p><strong>TimeoutStartSec=0</strong></p> <p><strong># set delegate yes so that systemd does not reset the cgroups of docker containers</strong></p> <p><strong>Delegate=yes</strong></p> <p><strong># kill only the docker process, not all processes in the cgroup</strong></p> <p><strong>KillMode=process</strong></p> <p><strong># restart the docker process if it exits prematurely</strong></p> <p><strong>Restart=on-failure</strong></p> <p><strong>StartLimitBurst=3</strong></p> <p><strong>StartLimitInterval=60s</strong></p> <p><strong> </strong></p> <p><strong>[Install]</strong></p> <p><strong>WantedBy=multi-user.target</strong></p> </td> </tr> </tbody> </table> 4、启动 chmod +x /etc/systemd/system/docker.service \#添加文件权限并启动docker systemctl daemon-reload \#重载unit配置文件 systemctl start docker \#启动Docker systemctl enable docker.service \#设置开机自启 **5****、验证** systemctl status docker \#查看Docker状态 docker -v \#查看Docker版本 转载自: [https://www.cnblogs.com/luoSteel/p/10038954.html][https_www.cnblogs.com_luoSteel_p_10038954.html] [Link 1]: https://download.docker.com/linux/static/stable/x86_64/ [https_pan.baidu.com_s_1YdN9z72QutPkHBfLq06H1A]: https://pan.baidu.com/s/1YdN9z72QutPkHBfLq06H1A [https_docs.docker.com_install_linux_docker-ce_binaries_install-static-binaries]: https://docs.docker.com/install/linux/docker-ce/binaries/#install-static-binaries [https_www.cnblogs.com_luoSteel_p_10038954.html]: https://www.cnblogs.com/luoSteel/p/10038954.html
还没有评论,来说两句吧...