LoginSignup
5
2

More than 5 years have passed since last update.

Ubuntu18.04でDockerが起動しなくなったので直す

Posted at

備忘録。

TL;DR

/lib/systemd/system/docker.service を開いて

[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 -H fd:// --containerd=/run/containerd/containerd.sock
+ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -s overlay2
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always

ExecStartの末尾に -s overlay2 を付ける

環境

  • Ubuntu 18.04 LTS
  • Docker CE
  • Intel Core i7-8700k

状況

Dockerのデーモンが立たない。以下journalctlのログ。

 3月 19 09:28:15 hibikine-ubuntu systemd[1]: Starting Docker Application Container Engine...
 3月 19 09:28:15 hibikine-ubuntu dockerd[32440]: time="2019-03-19T09:28:15.798499245+09:00" level=info msg="systemd-resolved is running, so using resolvconf: /run/systemd/resolve/resolv.conf"
 3月 19 09:28:15 hibikine-ubuntu dockerd[32440]: time="2019-03-19T09:28:15.799839330+09:00" level=info msg="parsed scheme: \"unix\"" module=grpc
 3月 19 09:28:15 hibikine-ubuntu dockerd[32440]: time="2019-03-19T09:28:15.799861547+09:00" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
 3月 19 09:28:15 hibikine-ubuntu dockerd[32440]: time="2019-03-19T09:28:15.799904289+09:00" level=info msg="parsed scheme: \"unix\"" module=grpc
 3月 19 09:28:15 hibikine-ubuntu dockerd[32440]: time="2019-03-19T09:28:15.799914365+09:00" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
 3月 19 09:28:15 hibikine-ubuntu dockerd[32440]: time="2019-03-19T09:28:15.800089701+09:00" level=info msg="ccResolverWrapper: sending new addresses to cc: [{unix:///run/containerd/containerd.sock 0  <nil
 3月 19 09:28:15 hibikine-ubuntu dockerd[32440]: time="2019-03-19T09:28:15.800094944+09:00" level=info msg="ccResolverWrapper: sending new addresses to cc: [{unix:///run/containerd/containerd.sock 0  <nil
 3月 19 09:28:15 hibikine-ubuntu dockerd[32440]: time="2019-03-19T09:28:15.800128469+09:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
 3月 19 09:28:15 hibikine-ubuntu dockerd[32440]: time="2019-03-19T09:28:15.800136387+09:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
 3月 19 09:28:15 hibikine-ubuntu dockerd[32440]: time="2019-03-19T09:28:15.800213818+09:00" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc4208082a0, CONNECTING" module=grpc
 3月 19 09:28:15 hibikine-ubuntu dockerd[32440]: time="2019-03-19T09:28:15.800216664+09:00" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc420802300, CONNECTING" module=grpc
 3月 19 09:28:15 hibikine-ubuntu dockerd[32440]: time="2019-03-19T09:28:15.800229123+09:00" level=info msg="blockingPicker: the picked transport is not ready, loop back to repick" module=grpc
 3月 19 09:28:15 hibikine-ubuntu dockerd[32440]: time="2019-03-19T09:28:15.800403950+09:00" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc420802300, READY" module=grpc
 3月 19 09:28:15 hibikine-ubuntu dockerd[32440]: time="2019-03-19T09:28:15.800412148+09:00" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc4208082a0, READY" module=grpc
 3月 19 09:28:15 hibikine-ubuntu dockerd[32440]: Error starting daemon: error initializing graphdriver: /var/lib/docker contains several valid graphdrivers: overlay, overlay2; Please cleanup or explicitly
 3月 19 09:28:15 hibikine-ubuntu systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
 3月 19 09:28:15 hibikine-ubuntu systemd[1]: docker.service: Failed with result 'exit-code'.
 3月 19 09:28:15 hibikine-ubuntu systemd[1]: Failed to start Docker Application Container Engine.

ダメだったこと

  • docker-ceの再インストール
    • 手順通りにやってもDockerデーモンを立てるところで死ぬ
  • aufs を消す
    • これやっちゃダメね
  • Linuxカーネル(linux-image-extra-virtual, linux-image-extra-$(uname -r))を再インストール

うまくいったこと

/lib/systemd/system/docker.service を開いて、起動オプションに -u overlay2 を付けた。

[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 -H fd:// --containerd=/run/containerd/containerd.sock
+ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -s overlay2
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always

感想

起動ファイルいじっちゃってるので再インストールの度に壊れそう。原因何だろう……。

5
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2