本文已参与「新人创作礼」活动, 一起开启掘金创作之路。
1、下载安装包地址如下
Index of linux/static/stable/x86_64/
2、cd /usr/local
mdkir docker
并将tag包上传
3、解压
tar -zxvf docker-20.10.9.tgz
编辑
4、cp文件cp docker/* /usr/bin/
编辑
5、cd /etc/systemd/system,新建文件touch docker.service
编辑
6、vi docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=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 --selinux-enabled=false --insecure-registry=127.0.0.1
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
7、给docker.service文件添加权限
编辑
8、重新加载配置文件
systemctl daemon-reload
编辑
9、启动docker
编辑
10、设置开机启动
编辑
11、查看docker服务状态
systemctl status docker
编辑
12、查看版本
docker -v
编辑
打完收工