Centos离线安装Docker
大约 2 分钟
下载离线安装包
下载地址: 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
系统推荐
- Oh My ZSH
- Git合并多个提交并push到远程仓库
- ES6.2.3(3节点)数据迁移到ES7.4.1(5节点)
- 随记
- Censys搜索引擎学习
- 线上FullGC频繁的排查
- linux_no_space_left_on_device
- PGSQL的json和 jsonb 读写性能测试
- Java面试基础
- sofajraft
- PostgreSQL JSON类型字段常用操作
- 杂记
- 随机毒鸡汤:我已经到了法定结婚年龄,请问去民政局领证的时候,老婆是自己带还是等他们发?