你的浏览器不支持canvas

做你害怕做的事情,然后你会发现,不过如此。

linux离线安装docker

时间: 作者: 黄运鑫

本文章属原创文章,未经作者许可,禁止转载,复制,下载,以及用作商业用途。原作者保留所有解释权。


  • 服务器版本CentOS Linux 7
  • 下载docker
  • 上传docker-20.10.9.tgz文件到服务器任意目录
  • 执行tar xzvf docker-20.10.9.tgz解压到当前目录,解压后得到docker文件夹
  • 执行cp docker/* /usr/bin/,将docker文件夹中的内容复制到/usr/bin目录下
  • /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
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加载配置文件
  • 执行systemctl start docker启动docker
  • 执行systemctl enable docker.servicedocker服务开机自启
  • 执行docker -v,验证是否启动成功

对于本文内容有问题或建议的小伙伴,欢迎在文章底部留言交流讨论。