LoginSignup
1
3

More than 3 years have passed since last update.

Raspberry Pi 4 (w/ Raspbian Buster) に docker をインストールする

Last updated at Posted at 2019-12-29

この記事は、OpenChain Japan WG Advent Calendar 201912/24公開記事の番外編の第2部です

概要

タイトルにある通りで、Raspberry Pi 4 (w/ Raspbian Buster) で Docker 環境を作る。

とうとつですが、Disclaimer... みたいな

この記事はどちらかというと備忘録に近い。手っ取り早く docker 環境を構築しようと適当にやってしまったので、正確に挙動を把握しながら作業をしたい人は、他の識者の記事などをみるのが良いです...

実施環境

  • Raspberry Pi 4 Model B, 4GB (以下、"RPi4")
  • microSDHC 32GB (Trabscend Premium 400x, TS32GUSDCU1, UHS-I, CLASS 10. 以下、"microSD")
  • この作業は、VNC経由で RPi4 にアクセスして実施している。準備方法は別記事「Raspberry Pi 4 に Raspbian Buster の環境をつくる」を参照のこと。

Docker のインストール

執筆時点では、スクリプト一発で終了。

docker_install_script
$ curl https://get.docker.com | sh

利用したいユーザアカウントで sudo 無しで docker コマンドを操作したいので、docker グループアカウントに入れる。

  1. group アカウントに docker があるかどうか確認する。
    • なければ、作成する。次の実施例では省略しているが、作成できたかどうかを念のために確認しておくこと。
  2. 利用したいユーザアカウントが docker グループに入っているかどうか確認する。
    • 入っていない場合、または先の手順で docker グループを作った場合、追加する。パラメータの my_user は自分の利用したいユーザアカウント。実施例では作成後の確認を省略している。
docker_account
$ grep docker /etc/group 
$ sudo groupadd docker
$ groups
$ sudo usermod -aG docker my_user

再ログイン後に、次を確認する。

docker_run_hello-world
$ docker -v
Docker version 19.03.5, build 633a0ea
$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c1eda109e4da: Pull complete 
Digest: sha256:4fe721ccc2e8dc7362278a29dc660d833570ec2682f4e4194f4ee23e415e1064
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (arm32v7)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

$ 

あっさりと動く。

おまけ

docker-compose をインストール出来たら、追記する予定。
次のコンポーネントの追加でできると思ったのだけど、なぜか、いくつかのモジュールのインストールがみつからなさげ...

2019.12.29 11:30 am 追記
時間切れなので、年越し案件になりそう。docoker-composer は手元でビルドするのが早いかも知れない...

docker_composer_install
$sudo apt-get install libffi-dev libssl-dev
$sudo apt-get install -y python python-pip
$sudo pip install docker-compose
1
3
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
1
3