docker服务以及配置文件详解

pigsmall 2020-08-11

1、dockerd&起动docker后怎样终止。
先寻找dockerd运作的pid
cat/etc/run/docker.pid
例如是pid是123
kill-9pid
删除文件夹
rm/etc/run/docker.pid
2、设定启动自动启动
配备service
vi/usr/lib/systemd/system/docker.service
复制代码
[Unit]
Description=DockerApplicationContainerEngine
Documentation=https://docs.docker.com
After=network-online.targetfirewalld.service
Wants=network-online.target
[Service]
Type=notify
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill-sHUP$MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
复制代码
systemctldaemon-reload
systemctlstartdocker.service
systemctlenabledocker.service#自动启动
輸出以下
Createdsymlinkfrom/etc/systemd/system/multi-user.target.wants/docker.serviceto/usr/lib/systemd/system/docker.service
4、docker作用
build,ship,run

相关推荐