LoginSignup
15
17

More than 5 years have passed since last update.

Raspberry Piでdockerを使う(HypriotOS)

Last updated at Posted at 2015-05-10

準備

http://blog.hypriot.com/downloads/
から hypriot-rpi-20150416-201537.img.zipをダウンロードしSDにdd。

ssh

  • pi / raspberry

hostnameを変更

/boot/occidentalis.txt

ip固定

/etc/network/interfaces
allow-hotplug eth0
iface eth0 inet static
        address 192.168.11.5
        netmask 255.255.255.0
        gateway 192.168.11.1

/ のパーティションを拡大する

メモリの空きを増やす

  • /boot/config.txt を作成し、gpu_mem=16を記述し再起動。

usbメモリを docker のイメージ格納ディレクトリにする

  • usbメモリを/media/usbにマウント
mkdir -p /media/usb/docker /media/usb/docker-tmp
chown pi:docker /media/usb/docker /media/usb/docker-tmp
/etc/default/docker
- DOCKER_OPTS="--storage-driver=overlay -D"
+ DOCKER_OPTS="--storage-driver=overlay -D -g /media/usb/docker/"
- #export TMPDIR="/mnt/bigdrive/docker-tmp"
+ export TMPDIR="/media/usb/docker-tmp"
sudo /etc/init.d/docker restart
ls /media/usb/docker

dockerイメージ

resin/rpi-raspbianが主に使われている様子。

せっかくなので自分仕様作った

Dockerfile
FROM resin/rpi-raspbian:jessie

RUN \
  set -eux ;\
  unlink /etc/localtime ;\
  ln -s /usr/share/zoneinfo/Japan /etc/localtime ;\
  sed -i -e "s@archive.raspbian.org@ftp.jaist.ac.jp@" /etc/apt/sources.list ;\
  apt-get update -qq ;\
  apt-get install -y vim-tiny dialog locales ;\
  sed -i -e "s@# ja_JP.UTF-8 UTF-8@ja_JP.UTF-8 UTF-8@" /etc/locale.gen ;\
  locale-gen ja_JP.UTF-8 ;\
  apt-get clean ;\
  echo "done"
  • console-setupがdialogで聞いてくる。これだとdocker buildが止まるので以下も実施
docker run -it tukiyo3/rpi-ja /bin/bash

apt-get install -y \
  apt-utils console-setup xrdp ttf-mona fontconfig

docker commit ContainerID tukiyo3/rpi-ja-xrdp
  • 特徴
    • 日本のミラーサイトに変更
    • apt-get updateがとても遅いので済ませておいた
    • ja_JP.UTF-8を作成済み
    • timezoneを日本
    • vim-tinyとdialogを最初から入れておいた。

使い方

docker run -it tukiyo3/rpi-ja /bin/bash
15
17
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
17