1. ホーム
  2. ドッカー

docker が正しく起動しない

2022-03-03 06:33:54
<パス

この記事でおすすめしている コンテナログ収集ソリューション

このマシンは、パブリックイメージを素早く引き出すための香港サーバーで、以前はkubernetesクラスタの1つとして使用されていました。様々な理由により、このマシンはクラスタから外されました。

その後、再度dockerを使用したところ、dockerが起動しないことが判明し、以下のようにエラーレポートを確認しました。

[root@ALY-HKC-PRO-001 ~]# systemctl restart docker
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and " journalctl -xe" for details.
[root@ALY-HKC-PRO-001 ~]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2017-07-03 10:12:16 CST; 5s ago
     Docs: http://docs.docker.com
  Process: 16172 ExecStart=/usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime= docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current $OPTIONS $DOCKER_ STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY (code=exited, status=1/FAILURE)
 Main PID: 16172 (code=exited, status=1/FAILURE)

Jul 03 10:12:15 ALY-HKC-PRO-001 systemd[1]: Starting Docker Application Container Engine...
Jul 03 10:12:15 ALY-HKC-PRO-001 dockerd-current[16172]: time="2017-07-03T10:12:15.812330534+08:00" level=info msg=" libcontainerd: new containerd process, pid: 16180"
Jul 03 10:12:16 ALY-HKC-PRO-001 dockerd-current[16172]: time="2017-07-03T10:12:16.823237678+08:00" level=warning msg=" devmapper: Usage of loopback devices is strongly discourage.... .v section."
Jul 03 10:12:16 ALY-HKC-PRO-001 dockerd-current[16172]: time="2017-07-03T10:12:16.838204058+08:00" level=error msg="[ graphdriver] prior storage driver \"devicemapper\" failed: d.. .run failed"
Jul 03 10:12:16 ALY-HKC-PRO-001 dockerd-current[16172]: time="2017-07-03T10:12:16.838278116+08:00" level=fatal msg="Error starting daemon: error initializing graphdriver: devmap... .run failed"
Jul 03 10:12:16 ALY-HKC-PRO-001 systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Jul 03 10:12:16 ALY-HKC-PRO-001 systemd[1]: Failed to start Docker Application Container Engine.
Jul 03 10:12:16 ALY-HKC-PRO-001 systemd[1]: Unit docker.service entered failed state.
Jul 03 10:12:16 ALY-HKC-PRO-001 systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.


ここで、Failed to start Docker Application Container Engineと表示されていることがわかります。

そこで、Webで同様のエラーを探したところ、firewalld.serviceとselinuxをオフにする必要があると書いてあるものがありました。まあ、それでdockerの起動に失敗することもあるのですが、このブログの原因はそれではないのです。

ブログ主が最初に思いついたのはdockerの再インストールでしたが、何度か削除を繰り返してもうまくいきません。(

ブログ主が最初に思いついたのはdockerの再インストールでしたが、削除を繰り返しても問題は解決されませんでした(笑)。

削除してサービスを再起動することで、dockerが正常に起動しない問題が解決されました。

# rm -rf /var/lib/docker/
# Add the following
# vim /etc/docker/daemon.json
{
    "graph": "/mnt/docker-data",
    "storage-driver": "overlay"
}


[root@ALY-HKC-PRO-001 ~]# systemctl restart docker
[root@ALY-HKC-PRO-001 ~]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2017-07-03 10:26:19 CST; 15s ago
     Docs: http://docs.docker.com
 Main PID: 17167 (dockerd-current)
   CGroup: /system.slice/docker.service
           ├─17167 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec -opt native.cgroupdriver=systemd --userlan...
           └─17175 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --shim docker-containerd-shim --metrics-interval=0 --start-timeout 2m -...

Jul 03 10:26:18 ALY-HKC-PRO-001 dockerd-current[17167]: time="2017-07-03T10:26:18.961963315+08:00" level=info msg="Graph migration to content-addressability took 0.00 seconds"
Jul 03 10:26:18 ALY-HKC-PRO-001 dockerd-current[17167]: time="2017-07-03T10:26:18.962211996+08:00" level=warning msg=" mountpoint for pids not found"
Jul 03 10:26:18 ALY-HKC-PRO-001 dockerd-current[17167]: time="2017-07-03T10:26:18.962703210+08:00" level=info msg="Loading containers: start."
Jul 03 10:26:19 ALY-HKC-PRO-001 dockerd-current[17167]: ........ .time="2017-07-03T10:26:19.230715822+08:00" level=info msg="Firewalld running: false"
Jul 03 10:26:19 ALY-HKC-PRO-001 dockerd-current[17167]: time="2017-07-03T10:26:19.379894482+08:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.30.. .IP address"
Jul 03 10:26:19 ALY-HKC-PRO-001 dockerd-current[17167]: time="2017-07-03T10:26:19.435937423+08:00" level=info msg="Loading containers: done."
Jul 03 10:26:19 ALY-HKC-PRO-001 dockerd-current[17167]: time="2017-07-03T10:26:19.436016788+08:00" level=info msg="Daemon has completed initialization"
Jul 03 10:26:19 ALY-HKC-PRO-001 dockerd-current[17167]: time="2017-07-03T10:26:19.436052792+08:00" level=info msg="Docker daemon" commit="1398f24/1.12.6" graphdriver=devicemappe.. .sion=1.12.6
Jul 03 10:26:19 ALY-HKC-PRO-001 dockerd-current[17167]: time="2017-07-03T10:26:19.441788942+08:00" level=info msg="API listen on /var/run/docker.sock"
Jul 03 10:26:19 ALY-HKC-PRO-001 systemd[1]: Started Docker Application Container Engine.
Hint: Some lines were ellipsized, use -l to show in full.



[root@ALY-HKC-PRO-001 ~]# systemctl restart docker
[root@ALY-HKC-PRO-001 ~]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2017-07-03 10:26:19 CST; 15s ago
     Docs: http://docs.docker.com
 Main PID: 17167 (dockerd-current)
   CGroup: /system.slice/docker.service
           ├─17167 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec -opt native.cgroupdriver=systemd --userlan...
           └─17175 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --shim docker-containerd-shim --metrics-interval=0 --start-timeout 2m -...

Jul 03 10:26:18 ALY-HKC-PRO-001 dockerd-current[17167]: time="2017-07-03T10:26:18.961963315+08:00" level=info msg="Graph migration to content-addressability took 0.00 seconds"
Jul 03 10:26:18 ALY-HKC-PRO-001 dockerd-current[17167]: time="2017-07-03T10:26:18.962211996+08:00" level=warning msg=" mountpoint for pids not found"
Jul 03 10:26:18 ALY-HKC-PRO-001 dockerd-current[17167]: time="2017-07-03T10:26:18.962703210+08:00" level=info msg="Loading containers: start."
Jul 03 10:26:19 ALY-HKC-PRO-001 dockerd-current[17167]: ........ .time="2017-07-03T10:26:19.230715822+08:00" level=info msg="Firewalld running: false"
Jul 03 10:26:19 ALY-HKC-PRO-001 dockerd-current[17167]: time="2017-07-03T10:26:19.379894482+08:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.30.. .IP address"
Jul 03 10:26:19 ALY-HKC-PRO-001 dockerd-current[17167]: time="2017-07-03T10:26:19.435937423+08:00" level=info msg="Loading containers: done."
Jul 03 10:26:19 ALY-HKC-PRO-001 dockerd-current[17167]: time="2017-07-03T10:26:19.436016788+08:00" level=info msg="Daemon has completed initialization"
Jul 03 10:26:19 ALY-HKC-PRO-001 dockerd-current[17167]: time="2017-07-03T10:26:19.436052792+08:00" level=info msg="Docker daemon" commit="1398f24/1.12.6" graphdriver=devicemappe.. .sion=1.12.6
Jul 03 10:26:19 ALY-HKC-PRO-001 dockerd-current[17167]: time="2017-07-03T10:26:19.441788942+08:00" level=info msg="API listen on /var/run/docker.sock"
Jul 03 10:26:19 ALY-HKC-PRO-001 systemd[1]: Started Docker Application Container Engine.
Hint: Some lines were ellipsized, use -l to show in full.



ブログ主は、この問題を解決する方法は他にもあると感じており、docker storage driverの詳細な説明でフォローする予定です。

このブログ記事で友人の問題が解決されれば幸いです~純粋に私の個人的な理解です、問題点があれば遠慮なくご指摘ください。