包括RHEL
在内的很多Linux
操作系统通过systemd
管理docker
。例如启动和停止docker daemon
:
# systemctl start docker
# systemctl stop docker
另外,可以使用systemctl status docker
检查目前docker daemon
的运行状态:
# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled)
Drop-In: /etc/systemd/system/docker.service.d
└─http-proxy.conf
Active: active (running) since Mon 2016-03-28 23:04:48 EDT; 21min ago
Docs: https://docs.docker.com
Main PID: 64991 (docker)
CGroup: /system.slice/docker.service
└─64991 /usr/bin/docker daemon -D -H fd://
Mar 28 23:08:51 lxc-dl980-g7-1-hLinux docker[64991]: time="2016-03-28T23:08:51.685679667-04:00" level=debug msg="devmapper: Delete...START"
Mar 28 23:08:51 lxc-dl980-g7-1-hLinux docker[64991]: time="2016-03-28T23:08:51.688765554-04:00" level=debug msg="devmapper: issueD...START"
Mar 28 23:08:51 lxc-dl980-g7-1-hLinux docker[64991]: time="2016-03-28T23:08:51.689292872-04:00" level=debug msg="devmapper: activa...c9f6)"
Mar 28 23:08:53 lxc-dl980-g7-1-hLinux docker[64991]: time="2016-03-28T23:08:53.050572512-04:00" level=debug msg="devmapper: issueD.... END"
.....
配置文件是/lib/systemd/system/docker.service
,修改这个文件后要记得使用systemctl daemon-reload
命令重新加载一下。
systemctl show docker
命令显示docker
的各种配置信息:
~# systemctl show docker
Type=notify
Restart=no
NotifyAccess=main
RestartUSec=100ms
TimeoutStartUSec=0
TimeoutStopUSec=1min 30s
WatchdogUSec=0
WatchdogTimestampMonotonic=0
StartLimitInterval=10000000
StartLimitBurst=5
StartLimitAction=none
FailureAction=none
PermissionsStartOnly=no
......
关于如何使用journalctl
查看log
,可以参考https://www.loggly.com/ultimate-guide/using-journalctl/。
绑定service
和运行的CPU
:https://www.golinuxhub.com/2018/02/how-to-assign-service-to-specific-core/ 。