Docker守护进程最近需要1分钟才能启动 - 为什么?

时间:2018-01-23 21:20:52

标签: linux docker fedora

问题

Docker systemd守护程序需要一分钟才能启动我的Fedora 27笔记本电脑。事情并非总是如此 - 我首先注意到1-2个月前的减速。如何加快Docker守护程序的启动时间?

分析

我查看了Docker引擎的日志,但没有用。有一个大窗口似乎没有发生任何事情。

# journalctl -fu docker
Jan 23 15:10:05 fossbook.justinwflory.com systemd[1]: Starting Docker Application Container Engine...
Jan 23 15:11:35 fossbook.justinwflory.com dockerd-current[20839]: time="2018-01-23T15:11:35.830665755-05:00" level=warning msg="devmapper: Usage of loopback devices is strongly discouraged for production use. Please use `--storage-opt dm.thinpooldev` or use `man docker` to refer to dm.thinpooldev section."
Jan 23 15:11:35 fossbook.justinwflory.com dockerd-current[20839]: time="2018-01-23T15:11:35.869370589-05:00" level=warning msg="devmapper: Base device already exists and has filesystem xfs on it. User specified filesystem  will be ignored."
Jan 23 15:11:35 fossbook.justinwflory.com dockerd-current[20839]: time="2018-01-23T15:11:35.885762067-05:00" level=info msg="[graphdriver] using prior storage driver: devicemapper"
Jan 23 15:11:35 fossbook.justinwflory.com dockerd-current[20839]: time="2018-01-23T15:11:35.893578695-05:00" level=info msg="Graph migration to content-addressability took 0.00 seconds"
Jan 23 15:11:35 fossbook.justinwflory.com dockerd-current[20839]: time="2018-01-23T15:11:35.894872003-05:00" level=warning msg="Your kernel does not support cgroup rt period"
Jan 23 15:11:35 fossbook.justinwflory.com dockerd-current[20839]: time="2018-01-23T15:11:35.895330760-05:00" level=warning msg="Your kernel does not support cgroup rt runtime"
Jan 23 15:11:35 fossbook.justinwflory.com dockerd-current[20839]: time="2018-01-23T15:11:35.896277400-05:00" level=info msg="Loading containers: start."
Jan 23 15:11:35 fossbook.justinwflory.com dockerd-current[20839]: time="2018-01-23T15:11:35.917175821-05:00" level=info msg="Firewalld running: true"
Jan 23 15:11:36 fossbook.justinwflory.com dockerd-current[20839]: time="2018-01-23T15:11:36.695388606-05:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address"
Jan 23 15:11:36 fossbook.justinwflory.com dockerd-current[20839]: time="2018-01-23T15:11:36.961050250-05:00" level=info msg="Loading containers: done."
Jan 23 15:11:36 fossbook.justinwflory.com dockerd-current[20839]: time="2018-01-23T15:11:36.975477466-05:00" level=warning msg="failed to retrieve docker-init version: unknown output format: tini version 0.16.1\n"
Jan 23 15:11:36 fossbook.justinwflory.com dockerd-current[20839]: time="2018-01-23T15:11:36.976280875-05:00" level=info msg="Daemon has completed initialization"
Jan 23 15:11:36 fossbook.justinwflory.com dockerd-current[20839]: time="2018-01-23T15:11:36.976323468-05:00" level=info msg="Docker daemon" commit=caba767-unsupported graphdriver=devicemapper version=1.13.1
Jan 23 15:11:36 fossbook.justinwflory.com dockerd-current[20839]: time="2018-01-23T15:11:36.993394464-05:00" level=info msg="API listen on /var/run/docker.sock"
Jan 23 15:11:36 fossbook.justinwflory.com systemd[1]: Started Docker Application Container Engine.

我不知道其他有用的信息可以帮助我调试这个。我知道过去的行为几乎是瞬间的 - 这似乎是回归或配置错误。

如何调试?

我不确定如何正确调试,因为日志无益。我可以在启动时获得更详细的信息吗?我怎么能弄清楚这花了多长时间?

1 个答案:

答案 0 :(得分:1)

要获取更多日志记录信息,请启用调试。

创建或编辑/etc/docker/daemon.json,请确保存在此密钥:

{ "debug": true }

重新加载Docker守护程序服务sudo systemctl reload docker,或者如果未安装systemd,则重新加载sudo kill -SIGHUP $(pidof dockerd)

https://docs.docker.com/config/daemon/#enable-debugging