遅いことこの上ないですが、少しずつDockerを試していってみようかなと思いまして。
こういう本も買ったことですし。
![Dockerエキスパート養成読本[活用の基礎と実践ノウハウ満載!] (Software Design plus) Dockerエキスパート養成読本[活用の基礎と実践ノウハウ満載!] (Software Design plus)](https://images-fe.ssl-images-amazon.com/images/I/51gFcibBx-L._SL160_.jpg)
Dockerエキスパート養成読本[活用の基礎と実践ノウハウ満載!] (Software Design plus)
- 作者: 杉山貴章,大瀧隆太,Yugui(Yuki Sonoda),中津川篤司,前佛雅人,松原豊,米林正明,松本勇気
- 出版社/メーカー: 技術評論社
- 発売日: 2015/06/18
- メディア: 大型本
- この商品を含むブログ (2件) を見る
自分の環境はUbuntu Linux 14.04 LTSなので、ここにDockerをインストールしてみます。
Dockerのインストール
普通にapt-getすると、ちょっと古いDockerが入るようなので、以下の手順で最新版のDockerが入るようにしました。
というか、ここの手順に沿っています。
Install Docker
http://docs.docker.com/linux/step_one/
$ wget -qO- https://get.docker.com/ | sh
sudoが絡んでいると思うのですが、途中でパスワードを求められます。
最後に、こんなことを言われます。
If you would like to use Docker as a non-root user, you should now consider adding your user to the "docker" group with something like: sudo usermod -aG docker (Dockerをインストールした時のユーザー名) Remember that you will have to log out and back in for this to take effect!
確認。
$ docker version Client version: 1.7.0 Client API version: 1.19 Go version (client): go1.4.2 Git commit (client): 0baf609 OS/Arch (client): linux/amd64 Get http:///var/run/docker.sock/v1.19/version: dial unix /var/run/docker.sock: permission denied. Are you trying to connect to a TLS-enabled daemon without TLS?
現時点で、1.7.0が入ったらしいです。最後に、なにかエラーっぽいものが…。
「Hello World」
それでは、ドキュメントに沿って「Hello World」してみます。
$ 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付ければいいかというと、そういうものでもないらしいです。
ちょっと調べてみて
こういうのを参考にして…
Dockerを一般ユーザで実行する
http://qiita.com/naomichi-y/items/93819573a5a51ae8cc07
are you trying to connect to a tls-enabled daemon without tls #3
https://github.com/docker-library/hello-world/issues/3
dockerコマンドを毎度sudo付けて実行するようにするか、一般ユーザーをdockerグループに属させる必要があるというのと、以下のコマンドが事前に必要みたいですね。
$ sudo start docker docker start/running, process 23468
というわけで、やっておきました。
※これ、通常は自動起動してるはずだから、以後は不要なはず…
気を取り直して「Hello World」
で、もう1度「Hello World」にトライ。今回はsudo付きにしました。
$ 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. This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (Assuming it was not already locally available.) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash For more examples and ideas, visit: http://docs.docker.com/userguide/
動きました!
まずは、インストール完了…。
この後、一般ユーザーをdockerグループに所属させました…。