2018年9月17日月曜日

CentOS 7.3 上の Docker 1.31.1 が SELinux のエラーで起動できない

CentOS 7 上に docker を yum でデフォルトインストールし、サービス起動しようとしたところ以下のエラーで起動できません。

-----
[root@mycentos7 takeda]# systemctl start 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@mycentos7 takeda]# 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 月 2018-09-17 00:56:24 JST; 1min 9s ago
     Docs: http://docs.docker.com
  Process: 10824 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 --init-path=/usr/libexec/docker/docker-init-current --seccomp-profile=/etc/docker/seccomp.json $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIES (code=exited, status=1/FAILURE)
 Main PID: 10824 (code=exited, status=1/FAILURE)

 9月 17 00:56:22 mycentos7 systemd[1]: Starting Docker Application Container Engine...
 9月 17 00:56:22 mycentos7 dockerd-current[10824]: time="2018-09-17T00:56:22.915287681+09:00" level=warning...und"
 9月 17 00:56:22 mycentos7 dockerd-current[10824]: time="2018-09-17T00:56:22.927551156+09:00" level=info ms...829"
 9月 17 00:56:24 mycentos7 dockerd-current[10824]: Error starting daemon: SELinux is not supported with the...lse)
 9月 17 00:56:24 mycentos7 systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
 9月 17 00:56:24 mycentos7 systemd[1]: Failed to start Docker Application Container Engine.
 9月 17 00:56:24 mycentos7 systemd[1]: Unit docker.service entered failed state.
 9月 17 00:56:24 mycentos7 systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
-----

STORAGE_DRIVER をデフォルトで設定される overlay2 から、devicemappr に変更すると起動できました。
-----
デフォルト
[root@mycentos7 takeda]# cat /etc/sysconfig/docker-storage-setup
STORAGE_DRIVER=overlay2
[root@mycentos7 takeda]# cat /etc/sysconfig/docker-storage
DOCKER_STORAGE_OPTIONS="--storage-driver overlay2 "
→変更
[root@mycentos7 takeda]# echo STORAGE_DRIVER=devicemappr > /etc/sysconfig/docker-storage-setup
[root@mycentos7 takeda]# echo DOCKER_STORAGE_OPTIONS="--storage-driver devicemapper " > /etc/sysconfig/docker-storage
→変更後
[root@mycentos7 takeda]# cat /etc/sysconfig/docker-storage-setup
STORAGE_DRIVER=devicemappr
[root@mycentos7 takeda]# cat /etc/sysconfig/docker-storage
DOCKER_STORAGE_OPTIONS=--storage-driver devicemapper
 (DOCKER_STORAGE_OPTIONS のみ変更で起動できましたが、一応両方 devicemappr に変更しています。)
-----
-----
[root@mycentos7 takeda]# systemctl start docker

[root@mycentos7 takeda]# 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 月 2018-09-17 01:14:58 JST; 6s ago
     Docs: http://docs.docker.com
 Main PID: 11778 (dockerd-current)
   CGroup: /system.slice/docker.service
           tq11778 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --...
           mq11782 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd....

 9月 17 01:14:57 mycentos7 dockerd-current[11778]: time="2018-09-17T01:14:57.433343640+09:00" level=warning...ed."
 9月 17 01:14:57 mycentos7 dockerd-current[11778]: time="2018-09-17T01:14:57.597673721+09:00" level=info ms...nds"
 9月 17 01:14:57 mycentos7 dockerd-current[11778]: time="2018-09-17T01:14:57.600587978+09:00" level=info ms...rt."
 9月 17 01:14:57 mycentos7 dockerd-current[11778]: time="2018-09-17T01:14:57.634389495+09:00" level=info ms...rue"
 9月 17 01:14:58 mycentos7 dockerd-current[11778]: time="2018-09-17T01:14:58.405195396+09:00" level=info ms...ess"
 9月 17 01:14:58 mycentos7 dockerd-current[11778]: time="2018-09-17T01:14:58.788143620+09:00" level=info ms...ne."
 9月 17 01:14:58 mycentos7 dockerd-current[11778]: time="2018-09-17T01:14:58.936721690+09:00" level=info ms...ion"
 9月 17 01:14:58 mycentos7 dockerd-current[11778]: time="2018-09-17T01:14:58.936809926+09:00" level=info ms...13.1
 9月 17 01:14:58 mycentos7 systemd[1]: Started Docker Application Container Engine.
 9月 17 01:14:58 mycentos7 dockerd-current[11778]: time="2018-09-17T01:14:58.958821424+09:00" level=info ms...ock"
Hint: Some lines were ellipsized, use -l to show in full.

以下の情報の通りです

 『CentOS 7:Docker App Container Engineの起動に失敗しました - graphdriverの初期化エラー:ドライバがサポートされていません #32』

 『SELinux is not supported with the overlay graph driver』

■環境は以下の通り。
 Docker:Docker version 1.13.1, build 6e3bb8e/1.13.1
 ゲストOS: CentOS Linux release 7.3.1611 (Core)
 ホストOS: Windows 10 1803
 VM:Virtual BOX 5.2.18 r124319 (Qt5.6.2)

■ overlay2 ドライバが SELinux で正しく動作しないことがエラーの理由のため、SELinuxのほうを無効化しても対処可能な模様です。

 『Dockerのボリュームプラグインとストレージドライバ(Dockerの最新機能を使ってみよう:第2回)』
 https://knowledge.sakura.ad.jp/5021/
   > overlayドライバを利用してみる

 ■参考サイト
 『Docker CE 構築 on CentOS7』
 https://qiita.com/sugimount/items/0b14b8d544ab1d95e219

0 件のコメント:

コメントを投稿