Raspbian上にdockerインストールでエラーにもめげずCentOS動かした件

[Raspberry pi公式ブログ](https://www.raspberrypi.org/blog/docker-comes-to-raspberry-pi/)を見ると、下記のコマンドを実行するだけのはずが、なぜかエラー。

* 公式ブログのコマンド
    * `curl -sSL https://get.docker.com | sh`
* 結果

```bash
pi@raspberrypi:~ $ curl -sSL https://get.docker.com | sh
# Executing docker install script, commit: 36b78b2
+ sudo -E sh -c apt-get update -qq >/dev/null
+ sudo -E sh -c apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
+ sudo -E sh -c curl -fsSL "https://download.docker.com/linux/raspbian/gpg" | apt-key add -qq - >/dev/null
Warning: apt-key output should not be parsed (stdout is not a terminal)
+ sudo -E sh -c echo "deb [arch=armhf] https://download.docker.com/linux/raspbian stretch edge" > /etc/apt/sources.list.d/docker.list
+ [ raspbian = debian ]
+ sudo -E sh -c apt-get update -qq >/dev/null
+ sudo -E sh -c apt-get install -y -qq --no-install-recommends docker-ce >/dev/null
E: Sub-process /usr/bin/dpkg returned an error code (1)
```

* 何度実行しても`E: Sub-process /usr/bin/dpkg returned an error code (1)
` が出る。

* [このissue](https://github.com/moby/moby/issues/30917#issuecomment-280041180)を参考に、`reboot`後に再度`curl -sSL https://get.docker.com | sh`を実行するとインストールが完了。

```bash
pi@raspberrypi:~ $ curl -sSL https://get.docker.com | sh
# Executing docker install script, commit: 36b78b2
Warning: the "docker" command appears to already exist on this system.

If you already have Docker installed, this script can cause trouble, which is
why we are displaying this warning and provide the opportunity to cancel the
installation.

If you installed the current Docker package using this script and are using it
again to update Docker, you can safely ignore this message.

You may press Ctrl+C now to abort this script.
+ sleep 20
+ sudo -E sh -c apt-get update -qq >/dev/null
+ sudo -E sh -c apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
W: APT had planned for dpkg to do more than it reported back (0 vs 4).
   Affected packages: docker-ce:armhf
+ sudo -E sh -c curl -fsSL "https://download.docker.com/linux/raspbian/gpg" | apt-key add -qq - >/dev/null
Warning: apt-key output should not be parsed (stdout is not a terminal)
+ sudo -E sh -c echo "deb [arch=armhf] https://download.docker.com/linux/raspbian stretch edge" > /etc/apt/sources.list.d/docker.list
+ [ raspbian = debian ]
+ sudo -E sh -c apt-get update -qq >/dev/null
+ sudo -E sh -c apt-get install -y -qq --no-install-recommends docker-ce >/dev/null
+ sudo -E sh -c docker version
Client:
 Version:      18.05.0-ce
 API version:  1.37
 Go version:   go1.9.5
 Git commit:   f150324
 Built:        Wed May  9 22:24:36 2018
 OS/Arch:      linux/arm
 Experimental: false
 Orchestrator: swarm

Server:
 Engine:
  Version:      18.05.0-ce
  API version:  1.37 (minimum version 1.12)
  Go version:   go1.9.5
  Git commit:   f150324
  Built:        Wed May  9 22:20:37 2018
  OS/Arch:      linux/arm
  Experimental: false
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!

WARNING: Adding a user to the "docker" group will grant the ability to run
         containers which can be used to obtain root privileges on the
         docker host.
         Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
         for more information.
```
  
ログを見ると一通りの手順をやっているのでOK認定。
よく見ると Docker CE Edgeがインストールさています。
Stableで良いのですが、このまま使うことにします。

### piユーザーをdockerグループに追加
* インストールログにある通り、下記を実行しておきます
  * `sudo usermod -aG docker pi`

### CentOSを動かして見る

* dockerのレポジトリにARM用CentOS7が用意されているようなので取得して見る

```bash
pi@raspberrypi:~ $ docker pull centos:centos7

centos7: Pulling from library/centos
d01992b4c8ee: Pull complete 
Digest: sha256:b67d21dfe609ddacf404589e04631d90a342921e81c40aeaf3391f6717fa5322
Status: Downloaded newer image for centos:centos7
```

* 入りました。

```bash
pi@raspberrypi:~ $ docker images
REPOSITORY          TAG             IMAGE ID            CREATED           SIZE
centos              centos7         aee182b938b6        4 weeks ago       175MB
```

* 起動して繋いで見る。

```bash
pi@raspberrypi:~ $ docker run -it centos:centos7 /bin/bash
[root@f47cee8f45d5 /]# cat /etc/redhat-release 
CentOS Linux release 7.5.1804 (Core) 
[root@f47cee8f45d5 /]#

```

Raspberry pi上で簡単にDockerが動かせることもそうですが、CentOSまで動かせるようになっていることに感動。