[メモ] Raspberry Pi で、Docker (docker.com純正? raspbian/jessie対応版)

> the latest release [officially includes Raspbian Jessie installation support.](https://github.com/docker/docker/pull/24815)

- (Dockerの)最新のリリースで正式にRaspbian Jessieへのインストールをサポートしたよ、とのこと。

## 概要

- `curl -sSL get.docker.com | sh`　一発.
- 参考記事: 
    - [Docker comes to Raspberry Pi](https://www.raspberrypi.org/blog/docker-comes-to-raspberry-pi/)
    - [Get Started with Docker 1.12 on Raspberry Pi](http://blog.alexellis.io/getting-started-with-docker-on-raspberry-pi/)

## 環境
- Raspberry Pi 3
- `2016-05-27-raspbian-jessie-lite.img`


# 手順
1. Raspbianを焼く
2. もろもろの設定
3. `docker`インストール
    1. `curl -sSL get.docker.com | sh`<br>dockerインストールスクリプト実行... 待つ
    2. `sudo usermod -aG docker pi`<br>ユーザ`pi`をグループ`docker`に追加して、一度ログアウトする... と、rootでないユーザーでもDockerが使える、とのこと

    ```txt
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 pi

        Remember that you will have to log out and back in for this to take effect!
```

4. 軽く使ってみる
    - `docker run -ti resin/rpi-raspbian:jessie /bin/bash`<br>=>　初回時はdockerイメージのダウンロードされる。
  
 



## 実行例

```shell-session
pi@raspberrypi:~ $ time curl -sSL get.docker.com | sh
+ sudo -E sh -c mkdir -p /etc/systemd/system/docker.service.d
+ sudo -E sh -c echo '[Service]\nExecStart=\nExecStart=/usr/bin/dockerd --storage-driver overlay -H fd://' > /etc/systemd/system/docker.service.d/overlay.conf
+ sudo -E sh -c sleep 3; apt-get update
Get:1 http://mirrordirector.raspbian.org jessie InRelease [14.9 kB]
Get:2 http://archive.raspberrypi.org jessie InRelease [13.2 kB]
.
.
.
Processing triggers for libc-bin (2.19-18+deb8u4) ...
Processing triggers for systemd (215-17+deb8u4) ...
+ sudo -E sh -c docker version
Client:
 Version:      1.12.1
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   23cf638
 Built:        Thu Aug 18 05:31:15 2016
 OS/Arch:      linux/arm

Server:
 Version:      1.12.1
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   23cf638
 Built:        Thu Aug 18 05:31:15 2016
 OS/Arch:      linux/arm

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 pi

Remember that you will have to log out and back in for this to take effect!


real	4m36.065s
user	0m46.370s
sys	0m12.900s
pi@raspberrypi:~ $ sudo usermod -aG docker pi
pi@raspberrypi:~ $ exit
logout
.
.
## 再ログイン.

pi@raspberrypi:~ $ docker run -ti resin/rpi-raspbian:jessie /bin/bash
Unable to find image 'resin/rpi-raspbian:jessie' locally
jessie: Pulling from resin/rpi-raspbian
2c21a521f21e: Pull complete 
d99cff50dc11: Pull complete 
c1c51ee47f0b: Pull complete 
e8b3c50e8e7e: Pull complete 
a3ed95caeb02: Pull complete 
7f56c2fb9a9c: Pull complete 
75010306b0df: Pull complete 
8837443d430d: Pull complete 
23dd9b04a2ec: Pull complete 
Digest: sha256:b6aef386a6da25bfbcba0e14a748e5473ff798233155fad960ae08fa4c94b146
Status: Downloaded newer image for resin/rpi-raspbian:jessie
root@d302245ade81:/# cat /etc/issue
Raspbian GNU/Linux 8 \n \l

root@d302245ade81:/# exit
exit
pi@raspberrypi:~ $ docker images
REPOSITORY           TAG                 IMAGE ID            CREATED             SIZE
resin/rpi-raspbian   jessie              0c648c095aee        3 days ago          117.2 MB
pi@raspberrypi:~ $ docker run -ti resin/rpi-raspbian:jessie /bin/bash   ##2度目はイメージのダウンロードしない.
root@75c79a527f8a:/# ls
bin  boot  dev	etc  home  lib	media  mnt  opt  proc  root  run  sbin	srv  sys  tmp  usr  var
root@75c79a527f8a:/# exit
exit
pi@raspberrypi:~ $ 
```