centos7にdockerをインストール
手順
Centos7用のrpmを使った手順もある(https://docs.docker.com/installation/centos/)が、 以下の公式ドキュメントの方法を使うほうが楽そう。
http://docs.docker.com/linux/started/
この手順でもrpmがインストールされるので、管理も楽。
# 公式の手順ではsudoはいらないとされているが、実際失敗したのでsudo指定
$ wget -qO- https://get.docker.com/ | sudo sh
無事インストールできたかテスト用のコマンドを実行
$ docker run hello-world Post http:///var/run/docker.sock/v1.19/containers/create: dial unix /var/run/docker.sock: permission denied. Are you trying to connect to a TLS-enabled daemon without TLS?
あれ?これもsudoが必要か
$ sudo docker run hello-world Cannot connect to the Docker daemon. Is 'docker -d' running on this host?
どうやらdocker daemonを起動しないといけないらしい。
$ sudo systemctl start docker $ sudo docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from hello-world a8219747be10: Pull complete 91c95931e552: Already exists hello-world:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security. Digest: sha256:aa03e5d0d5553b4c3473e89c8619cf79df368babd18681cf5daeb82aab55838d Status: Downloaded newer image for hello-world:latest Hello from Docker. ~~~~~~
成功!
# 再起動後もdockerサービスを有効にする $ sudo systemctl enable docker $ docker -$ docker --version Docker version 1.7.1, build 786b29d $ rpm -qa docker* docker-engine-1.7.1-1.el7.centos.x86_64
最新版がインストールされている。