ラズパイでdockerを試してみました。
参考
Raspbian Jessie Lite OSは、 2017-03-02-raspbian-jessie-lite
を使いました。
1
2
3
4
5
6
7
8
pi@raspberrypi:~ $ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 8.0 (jessie)
Release: 8.0
Codename: jessie
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.4.50-v7+ #970 SMP Mon Feb 20 19:18:29 GMT 2017 armv7l GNU/Linux
dockerインストール 公式blogに書かれていた通りにインストール。
1
pi@raspberrypi:~ $ curl -sSL https://get.docker.com/ | sh
インストールが成功したのでバージョンをみてみると 17.03.0-ce
と表示されています。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
pi@raspberrypi:~ $ sudo docker version
Client:
Version: 17.03.0-ce
API version: 1.26
Go version: go1.7.5
Git commit: 60ccb22
Built: Thu Feb 23 11:32:23 2017
OS/Arch: linux/arm
Server:
Version: 17.03.0-ce
API version: 1.26 (minimum version 1.12)
Go version: go1.7.5
Git commit: 60ccb22
Built: Thu Feb 23 11:32:23 2017
OS/Arch: linux/arm
Experimental: false
hypriot/rpi-busybox-httpd hypriot/rpi-busybox-httpd
を実行させてみます。
1
2
3
4
5
6
7
8
9
10
pi@raspberrypi:~ $ sudo docker run -d -p 80:80 hypriot/rpi-busybox-httpd
Unable to find image 'hypriot/rpi-busybox-httpd:latest' locally
latest: Pulling from hypriot/rpi-busybox-httpd
c74a9c6a645f: Pull complete
6f1938f6d8ae: Pull complete
e1347d4747a6: Pull complete
a3ed95caeb02: Pull complete
Digest: sha256:c00342f952d97628bf5dda457d3b409c37df687c859df82b9424f61264f54cd1
Status: Downloaded newer image for hypriot/rpi-busybox-httpd:latest
2148925e12ae491aa4021bc8fbb4b805d231970f7fa0131ab6863b5305a12651
docker ps
で確認
1
2
3
pi@raspberrypi:~ $ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2148925e12ae hypriot/rpi-busybox-httpd "/bin/busybox http..." 4 minutes ago Up 4 minutes 0.0.0.0:80->80/tcp silly_wing
起動してるようなので、ブラウザから確認
成功です。
resin/rpi-raspbian 次は、 resin/rpi-raspbian
でbashを起動してみようと思います。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
pi@raspberrypi:~ $ sudo docker run -ti resin/rpi-raspbian /bin/bash
Unable to find image 'resin/rpi-raspbian:latest' locally
latest: Pulling from resin/rpi-raspbian
eac41cf09c82: Pull complete
21ead82203de: Pull complete
fd836eb35b05: Pull complete
2592a5434813: Pull complete
a2152cfacf3a: Pull complete
b33ce1ee8e2a: Pull complete
62c1f626db90: Pull complete
58de8a7143d5: Pull complete
Digest: sha256:460d92358b6b024a8cb65333d85c5c40d6ed30f7b4722098d92f3315c9d0c20b
Status: Downloaded newer image for resin/rpi-raspbian:latest
pi@raspberrypi:~ $
PULLはしたようですが、bashが起動しませんでしたので、psでみてみます。
1
2
3
pi@raspberrypi:~ $ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fdb8a47943c7 resin/rpi-raspbian "/usr/bin/entry.sh..." About a minute ago Exited (149) About a minute ago confident_varahamihira
Exited していました。
resin/rpi-raspbian - Docker Hub
Short Description Base image for the Raspberry Pi. Contains both wheezy(stable) and jessie(testing) tags. As this is a base image there is no Dockerfile from which it was created.
を参照するとwheezyがstableらしいのwheezyで再トライしてみます。
1
2
3
pi@raspberrypi:~ $ sudo docker run -ti resin/rpi-raspbian:wheezy /bin/bash
udevd[7]: error: runtime directory '/run/udev' not writable, for now falling back to '/dev/.udev'
root@7e9402b0b222:/#
成功しました。 rootでbashが使えています。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
root@7e9402b0b222:/# apt-get update
Get:1 http://resin-packages.s3-website-us-east-1.amazonaws.com resin Release.gpg [801 B]
Get:2 http://resin-packages.s3-website-us-east-1.amazonaws.com resin Release [2258 B]
Get:3 http://resin-packages.s3-website-us-east-1.amazonaws.com resin/main armhf Packages [2633 B]
Get:4 http://archive.raspbian.org wheezy Release.gpg [473 B]
Get:5 http://archive.raspberrypi.org wheezy Release.gpg [473 B]
Get:6 http://archive.raspbian.org wheezy Release [14.4 kB]
Get:7 http://archive.raspberrypi.org wheezy Release [17.6 kB]
Get:8 http://archive.raspbian.org wheezy/main armhf Packages [9599 kB]
Get:9 http://archive.raspberrypi.org wheezy/main armhf Packages [145 kB]
Get:10 http://archive.raspbian.org wheezy/contrib armhf Packages [26.4 kB]
Get:11 http://archive.raspbian.org wheezy/non-free armhf Packages [58.0 kB]
Get:12 http://archive.raspbian.org wheezy/rpi armhf Packages [511 B]
Get:13 http://archive.raspbian.org wheezy/firmware armhf Packages [1176 B]
Fetched 9868 kB in 1min 13s (134 kB/s)
Reading package lists... Done
root@7e9402b0b222:/#
apt-getも成功しました。 上から3つがresinのパッケージのようです。
これから色々とdockerイメージを作成してみようと思います。