2019年11月12日 星期二

Docker 無法啟動

有好一陣子沒用自己電腦的 docker 了,今天想改個系統,道然無法啟動 docker 了。
只用 systemctl status docker.service
實在看不出問題出在那裡。

找到下面的網頁,照著下面的指令可以查詳細的 log 資訊。
https://forum.manjaro.org/t/docker-service-cant-start-solved/93410/3

sudo journalctl --no-hostname --no-pager -b -u docker.service

非常多的訊息,慢慢追,直到下面這段訊息,就跳出來了
11月 13 15:24:36 dockerd[21959]: Error starting daemon: Devices cgroup isn't mounted

用上面的訊息再 Google,找到這個網頁,似乎和 systemd 有關。
https://github.com/docker/cli/issues/2104

Found the "bug"...
I forgot to mention in my previous comment that I use(d) systemd version 243.
With systemd 242 works everything flawlessly... :)
From the systemd changelog:
        * systemd now defaults to the "unified" cgroup hierarchy setup during
          build-time, i.e. -Ddefault-hierarchy=unified is now the build-time
          default. Previously, -Ddefault-hierarchy=hybrid was the default. This
          change reflects the fact that cgroupsv2 support has matured
          substantially in both systemd and in the kernel, and is clearly the
          way forward. Downstream production distributions might want to
          continue to use -Ddefault-hierarchy=hybrid (or even =legacy) for
          their builds as unfortunately the popular container managers have not
          caught up with the kernel API changes.
Sooo... Houston, we have a problem:
  1. systemd will (or already did) jump on the cgroupsv2 bandwagon...
  2. cgroupfs-mount tools does not work with newer systemd setups.
"Same" issue in kubernetes

再查 Gentoo 的 docker wiki,發現關於 systemd 的說明,要加上 USE flag: cgroup-hybrid。加上後重新 emerge,再重開就 OK 了。

https://wiki.gentoo.org/wiki/Docker#systemd

Docker service fails because cgroup device not mounted (systemd)

By default systemd uses hybrid cgroup hierarchy combining cgroup and cgroup2 devices. Docker still needs cgroup(v1) devices. Activate USE flag cgroup-hybrid for systemd.
Activate USE flag for systemd
FILE /etc/portage/package.use/systemd
sys-apps/systemd cgroup-hybrid
Install systemd with the new USE flags
root #emerge --ask --oneshot sys-apps/systemd



沒有留言:

張貼留言

網誌存檔