rpi4 docker portainer
https://blog.cloudkernels.net/posts/rpi4-64bit-virt/
https://news.ycombinator.com/item?id=20410169
Raspberry Pi 4B 用のUbuntu Server 18.04.2 64bit のイメージが公開されていたので試してみました。
Docker 環境も構築されています。

UPDATE: 2019/7/14 軽量なイメージが公開されました。

https://cloudkernels.net/ubuntu-18.04.2-preinstalled-server-arm64+raspi4+kvm.img.xz

環境構築

準備

  • Raspberry Pi 4B
  • SDカード 32GB
  • https://cloudkernels.net/rpi4-64-bit-kvm-docker.img.xz
  • etcher で書き込み(2.5GB が8.07GB に展開される)
  • 初回ブートに時間がかかる or reboot しないといけないかも
  • root のパスワードは無し
  • pi, ubuntu アカウントが存在する
  • port 80 nginx

設定(オプション)

  • /etc/hosts にpi4 を追加
    /etc/hosts
    127.0.0.1 localhost pi4
  • sshd のポリシー設定変更
    /etc/ssh/sshd_config
  • ユーザの追加
    $ sudo adduser hoge
    $ sudo gpasswd -a hoge docker
    $ sudo systemctl daemon-reload
    $ sudo systemctl restart docker
  • nginx 無効化
    $ sudo systemctl stop nginx
    $ sudo systemctl disable nginx

実行結果

OS 情報

$ uname -a
Linux pi4 4.19.57-v8+ #2 SMP PREEMPT Tue Jul 9 20:31:37 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"

CPU 情報

$ lscpu
Architecture: aarch64
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1
Vendor ID: ARM
Model: 3
Model name: Cortex-A72
Stepping: r0p3
CPU max MHz: 1500.0000
CPU min MHz: 600.0000
BogoMIPS: 108.00
Flags: fp asimd evtstrm crc32 cpuid

メモリ情報

現時点ではメモリを1GBに制限しています。

$ free -m -h
total used free shared buff/cache available
Mem: 917M 204M 203M 12M 509M 687M
Swap: 0B 0B 0B

ストレージ情報

$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 7.1G 3.7G 3.1G 54% /
devtmpfs 331M 0 331M 0% /dev
tmpfs 459M 0 459M 0% /dev/shm
tmpfs 459M 13M 447M 3% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 459M 0 459M 0% /sys/fs/cgroup
/dev/loop0 79M 79M 0 100% /snap/core/7172
/dev/loop1 83M 83M 0 100% /snap/go/4095
/dev/loop2 79M 79M 0 100% /snap/core/7275
/dev/loop3 83M 83M 0 100% /snap/go/3956
/dev/mmcblk0p1 253M 112M 141M 45% /boot
tmpfs 92M 0 92M 0% /run/user/0
tmpfs 92M 0 92M 0% /run/user/1001

Docker バージョン

$ docker --version
Docker version 18.09.7, build 2d0083d
$ docker-compose --version
docker-compose version 1.17.1, build unknown

Docker システム情報

$ docker system info                                                             
Containers: 29
Running: 0
Paused: 0
Stopped: 29
Images: 6
Server Version: 18.09.7
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc runnc
Default Runtime: runc
Init Binary: docker-init
containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 4.19.57-v8+
Operating System: Ubuntu 18.04.2 LTS
OSType: linux
Architecture: aarch64
CPUs: 4
Total Memory: 917MiB
Name: pi4
ID: 63DU:AQ23:GYZI:IPZ7:M7XX:JJTI:O33H:IND4:HH46:7YPL:RISU:LYZF
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

WARNING: No swap limit support
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support

Docker イメージ情報

$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
redis latest a05cff133c70 3 days ago 90.1MB
cloudkernels/memcached-hvt aarch64 416c7328ae41 3 months ago 25.7MB
cloudkernels/nginx-nabla aarch64 c9d5acb805d4 3 months ago 39.7MB
cloudkernels/nginx-hvt aarch64 53ebcae8baa6 3 months ago 39.8MB
cloudkernels/redis-hvt aarch64 5d5dbb5439f6 3 months ago 27MB
cloudkernels/redis-nabla aarch64 e05a0c30fa58 3 months ago 26.9MB

Docker コンテナの追加

Portainer

  • docker-compose.yml
    docker-portainer/docker-compose.yml
    version: '2'
    services:
    portainer:
    restart: always
    image: portainer/portainer
    container_name: portainer
    ports:
    - "9000:9000"
    volumes:
    - /var/run/docker.sock:/var/run/docker.sock
    - ./data:/data
  • 起動
    $ cd docker-portainer
    $ docker-compose up -d
  • アクセス
    http://192.168.11.14:9000/
    admin に8文字以上のパスワードを設定