Centos离线安装Docker
大约 3 分钟
下载离线安装包
下载地址: https://download.docker.com/linux/static/stable/x86_64/
这里选择了 docker-19.03.12.tgz
禁用SELinux
如果不禁用的话,本人遇到过如下问题:在开启防火墙的情况下,执行systemctl start docker 卡死。 关闭防火墙后,上面的命令就能正常启动
vi /etc/selinux/config
编辑上面的文件把SELINUX设置为disabled,重启后生效,如果不重启可以通过命令临时生效: setenforce 0
解压
tar -zxvf 离线安装包
mv docker/* /usr/bin
编辑开机启动脚本
vi /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
启动Docker
//赋予执行权限
chmod +x /etc/systemd/system/docker.service
//设置开启启动
systemctl enable docker
//启动docker
systemctl start docker
系统推荐
- 记一次内存泄漏
- Notion笔记定时备份
- RSA 加密解密多语言实现方案
- Redis笔记
- CloudFlare 客户端证书的使用
- 乱七八糟的笔记
- Sublime Text 格式化JSON
- 线上FullGC频繁的排查
- 批量替换文件名中的指定字符串
- BBR加速
- Hbase 总览
- https和http混用解决办法
- 随机毒鸡汤:你只要不抬杠,钱真的是万能的。