しまかぜメモ

@kinunoriの雑なメモ

CentOS7でDockerを動かす場合

普通にOS入れるとdevice-mapper入ってないんだな。

[root@rails sample]# service docker start
Redirecting to /bin/systemctl start  docker.service
Job for docker.service failed. See 'systemctl status docker.service' and 'journalctl -xn' for details.

コケる

[root@rails sample]# systemctl status docker.service -l
docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled)
   Active: failed (Result: exit-code) since Thu 2015-04-02 07:15:20 JST; 16s ago
     Docs: http://docs.docker.com
  Process: 10424 ExecStart=/usr/bin/docker -d $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY (code=exited, status=127)
 Main PID: 10424 (code=exited, status=127)

Apr 02 07:15:20 rails.cloud-lab.internal docker[10424]: time="2015-04-02T07:15:20+09:00" level="info" msg="+job serveapi(unix:///var/run/docker.sock)"
Apr 02 07:15:20 rails.cloud-lab.internal docker[10424]: /usr/bin/docker: relocation error: /usr/bin/docker: symbol dm_task_get_info_with_deferred_remove, version Base not defined in file libdevmapper.so.1.02 with link time reference
Apr 02 07:15:20 rails.cloud-lab.internal systemd[1]: docker.service: main process exited, code=exited, status=127/n/a
Apr 02 07:15:20 rails.cloud-lab.internal systemd[1]: Failed to start Docker Application Container Engine.
Apr 02 07:15:20 rails.cloud-lab.internal systemd[1]: Unit docker.service entered failed state.

libdevmapper.so.1.02 ないんか。

[root@rails sample]# yum -y install libdevmapper.so.1.02

入った

[root@rails sample]# systemctl start docker

[root@rails sample]#
[root@rails sample]# systemctl status docker
docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled)
   Active: active (running) since Thu 2015-04-02 07:19:17 JST; 4s ago
     Docs: http://docs.docker.com
 Main PID: 10670 (docker)
   CGroup: /system.slice/docker.service
           mq10670 /usr/bin/docker -d --selinux-enabled --add-registry registry.access.redha...

Apr 02 07:19:09 rails.cloud-lab.internal docker[10670]: time="2015-04-02T07:19:09+09:00" le..."
Apr 02 07:19:09 rails.cloud-lab.internal docker[10670]: time="2015-04-02T07:19:09+09:00" le..."
Apr 02 07:19:16 rails.cloud-lab.internal docker[10670]: time="2015-04-02T07:19:16+09:00" le..."
Apr 02 07:19:16 rails.cloud-lab.internal docker[10670]: time="2015-04-02T07:19:16+09:00" le..."
Apr 02 07:19:17 rails.cloud-lab.internal docker[10670]: time="2015-04-02T07:19:17+09:00" le..."
Apr 02 07:19:17 rails.cloud-lab.internal docker[10670]: time="2015-04-02T07:19:17+09:00" le..."
Apr 02 07:19:17 rails.cloud-lab.internal docker[10670]: time="2015-04-02T07:19:17+09:00" le..."
Apr 02 07:19:17 rails.cloud-lab.internal docker[10670]: time="2015-04-02T07:19:17+09:00" le..."
Apr 02 07:19:17 rails.cloud-lab.internal docker[10670]: time="2015-04-02T07:19:17+09:00" le..."
Apr 02 07:19:17 rails.cloud-lab.internal systemd[1]: Started Docker Application Container ...e.
Hint: Some lines were ellipsized, use -l to show in full.

動いたので、enableにする

[root@rails sample]# systemctl enable docker
ln -s '/usr/lib/systemd/system/docker.service' '/etc/systemd/system/multi-user.target.wants/docker.service'

Done.