Raspberry Pi 4์ Ubuntu 20.04 LTS ๋ฐ Docker ์ค์น
3ํ ์ ๋ฆฌ
1. ์๊ฐ
2020๋ 4์ 23์ผ์ ใUbuntu 20.04 LTSใ(๊ฐ๋ฐ ์ฝ๋: Focal Fossa)๊ฐ ๋ฆด๋ฆฌ์ค ๋์์ต๋๋ค.
Kubernetes ํ๊ฒฝ์ ์ ๋ฐ์ดํธํ๊ธฐ ์ํด Ubuntu 20.04 LTS๋ฅผ Raspberry Pi 4์ ์ค์นํ๊ณ Docker๋ฅผ ์ค์นํ์ต๋๋ค.
ํนํ ๋ฌธ์ ์๋ ์กฐ์ฐํ์ง ์์์ต๋๋ค๋ง, ์ผ๋จ ๊ธฐ๋กํด ๋ก๋๋ค.
2. ๊ตฌ์ฑ
์ด๋ฒ ๊ตฌ์ฑ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
์ด๋ฏธ์ง์ ๊ธฐ์ ์, macOS 10.14.6(Mojave) ํ๊ฒฝ์์ ์ค์ํ์ต๋๋ค.
mac$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.14.6
BuildVersion: 18G103
3. Ubuntu Server ์ด๋ฏธ์ง ๋ค์ด๋ก๋
Raspberry Pi์ฉ "Ubuntu Server"์ ์ด๋ฏธ์ง "Install Ubuntu Server on a Raspberry Pi 2, 3 or 4"์์ ๋ค์ด๋ก๋ํฉ๋๋ค.
xz
ํ์์ผ๋ก ์์ถ๋์ด ์์ง๋ง, ํ์ ํ๋ ใRaspberry Pi Imagerใ๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ, ์ ๊ฐ๋ ๋ถํ์ํฉ๋๋ค.์ด๋ฒ ๋ค์ด๋ก๋ํ ์ด๋ฏธ์ง์ ์ฌ์ด์ฆ, ํด์๊ฐ(SHA-256)์ ์ดํ์ ๊ฐ์ต๋๋ค. ์ฝ 667MiB.
mac$ ls -l ubuntu-20.04-preinstalled-server-arm64+raspi.img.xz
-rw-r--r--@ 1 yuya staff 699424400 May 4 18:01 ubuntu-20.04-preinstalled-server-arm64+raspi.img.xz
mac$ shasum -a 256 ubuntu-20.04-preinstalled-server-arm64+raspi.img.xz
48167067d65c5192ffe041c9cc4958cb7fcdfd74fa15e1937a47430ed7b9de99 ubuntu-20.04-preinstalled-server-arm64+raspi.img.xz
4. Ubuntu Server ์ด๋ฏธ์ง๋ฅผ microSD ์นด๋์ ์๋๋ค.
๋ค์ด๋ก๋ํ ์ด๋ฏธ์ง๋ฅผ "Raspberry Pi Imager"๋ฅผ ์ฌ์ฉํ์ฌ microSD ์นด๋์ ์๋๋ค.
Raspberry Pi Imager๋ Raspberry Pi ๊ณต์ ์ด๋ฏธ์ง ์ฐ๊ธฐ ๋๊ตฌ๋ก "Raspberry Pi Downloads"์์ ๋ค์ด๋ก๋ ํ ์ ์์ต๋๋ค.
Homebrew๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ cask๋ฅผ ์ฌ์ฉํ์ฌ ์ค์นํ ์ ์์ต๋๋ค.
mac$ brew cask install raspberry-pi-imager
...
==> Downloading https://downloads.raspberrypi.org/imager/imager.dmg
######################################################################## 100.0%
==> No SHA-256 checksum defined for Cask 'raspberry-pi-imager', skipping verification.
==> Installing Cask raspberry-pi-imager
==> Moving App 'Raspberry Pi Imager.app' to '/Applications/Raspberry Pi Imager.app'.
๐บ raspberry-pi-imager was successfully installed!
Raspberry Pi Imager๋ฅผ ์์ํ๊ณ ์ด๋ฏธ์ง ํ์ผ, ์ฐ๊ธฐ ๋์ ์ฅ์น๋ฅผ ์ ํํ๊ณ ๋ ์ฝ๋ฉ์ ์ํํฉ๋๋ค.

์ด Raspberry Pi์๋ Kubernetes๋ ๋์ ํ ์์ ์ด๋ฏ๋ก ์ด๋ฏธ์ง๋ฅผ ์ด ํ cgroup์ ์ค์ ๋ ์จ ๋ก๋๋ค.
mac$ sed -i -e 's/$/ cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1/' /Volumes/system-boot/cmdline.txt
mac$ cat /Volumes/system-boot/cmdline.txt
net.ifnames=0 dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=LABEL=writable rootfstype=ext4 elevator=deadline rootwait fixrtc cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1
5. Ubuntu Server ํ๊ฒฝ ํ์ธ
์ด๋ฏธ์ง๋ฅผ ์ด microSD ์นด๋๋ฅผ Raspberry Pi์ ๋ฃ๊ณ ๋ถํ ํฉ๋๋ค. ์ฒ์ ๋ถํ ํ๋ ๋ฐ ์๊ฐ์ด ๊ฑธ๋ฆฌ๋ฏ๋ก ๋ก๊ทธ์ธ ํ๋ฉด์ด ํ์๋ ๋๊น์ง ์ ์ ๊ธฐ๋ค๋ฆฝ๋๋ค. (Enter ํค๋ฅผ ๋๋ฅด์ง ์์ผ๋ฉด ๋ก๊ทธ์ธ ํ๋ฉด์ด ํ์๋์ง ์์ ์ ์์ต๋๋ค)
๋ํ, ๋ํดํธ์ ์ ์ ๋ช ์
ubuntu
, ํจ์ค์๋๋ ๋ง์ฐฌ๊ฐ์ง๋ก ubuntu
์
๋๋ค.์ฒ์ ๋ก๊ทธ์ธํ๋ฉด ๋น๋ฐ๋ฒํธ๋ฅผ ๋ณ๊ฒฝํ๋ผ๋ ๋ฉ์์ง๊ฐ ํ์๋๋ฏ๋ก ์ ๋น๋ฐ๋ฒํธ๋ฅผ ์ค์ ํฉ๋๋ค.
์ฐธ๊ณ ๋ก, ๊ธฐ๋ ์งํ์ ํ๊ฒฝ์ ์ดํ์ ๋ํ๋ ๋๋ค.
ubuntu@ubuntu:~$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
ubuntu@ubuntu:~$ uname -a
Linux ubuntu 5.4.0-1008-raspi #8-Ubuntu SMP Wed Apr 8 11:13:06 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux
ubuntu@ubuntu:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 876M 0 876M 0% /dev
tmpfs 185M 3.9M 181M 3% /run
/dev/mmcblk0p2 30G 2.0G 26G 7% /
tmpfs 925M 0 925M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 925M 0 925M 0% /sys/fs/cgroup
/dev/mmcblk0p1 253M 62M 191M 25% /boot/firmware
/dev/loop0 24M 24M 0 100% /snap/snapd/7267
/dev/loop1 49M 49M 0 100% /snap/core18/1708
/dev/loop2 62M 62M 0 100% /snap/lxd/14808
/dev/loop3 49M 49M 0 100% /snap/core18/1753
tmpfs 185M 0 185M 0% /run/user/1000
/dev/loop4 62M 62M 0 100% /snap/lxd/14894
ubuntu@ubuntu:~$ cat /proc/cmdline
coherent_pool=1M 8250.nr_uarts=1 cma=64M bcm2708_fb.fbwidth=1824 bcm2708_fb.fbheight=984 bcm2708_fb.fbswap=1 smsc95xx.macaddr=DC:A6:32:0A:62:1B vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 net.ifnames=0 dwc_otg.lpm_enable=0 console=ttyS0,115200 console=tty1 root=LABEL=writable rootfstype=ext4 elevator=deadline rootwait fixrtc cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1 quiet splash
ubuntu@ubuntu:~$ cat /proc/cpuinfo | grep Model
Model : Raspberry Pi 4 Model B Rev 1.1
ubuntu@ubuntu:~$ cat /proc/meminfo | head -n 3
MemTotal: 1892576 kB
MemFree: 864424 kB
MemAvailable: 1557632 kB
6. Docker ์ค์น
Ubuntu ํ์ค ํจํค์ง ๋ฆฌํฌ์งํ ๋ฆฌ์๋ ์ต์ Docker(2020๋ 5์ 4์ผ ํ์ฌ v19.03.8) ํจํค์ง๊ฐ ํฌํจ๋์ด ์์ต๋๋ค.
๋ฐ๋ผ์ Docker์ Ubuntu ํจํค์ง๊ฐ ์๋ Ubuntu ํ์ค ํจํค์ง์์ Docker๋ฅผ ์ค์นํ์ต๋๋ค.
apt show docker.io
์ ๊ฒฐ๊ณผ์๋ ์ดํ์ ๊ธฐ์ ์ด ํฌํจ๋์ด ์์ต๋๋ค๋ง, ์ ์ด๋ ARM64 ํ๊ฒฝ์์๋ ์ ์์ ์ผ๋ก ๋์ํ๊ณ ์๋ ๊ฒ ๊ฐ์ต๋๋ค.Using docker.io on non-amd64 hosts is not supported at this time.
ubuntu@ubuntu:~$ sudo apt update
ubuntu@ubuntu:~$ apt show docker.io
Package: docker.io
Version: 19.03.8-0ubuntu1
Built-Using: glibc (= 2.31-0ubuntu4)
Priority: optional
Section: universe/admin
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Paul Tagliamonte <paultag@debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 151 MB
Depends: adduser, containerd (>= 1.2.6-0ubuntu1~), iptables, debconf (>= 0.5) | debconf-2.0, libc6 (>= 2.17), libdevmapper1.02.1 (>= 2:1.02.97), libseccomp2 (>= 2.1.0), libsystemd0 (>= 209~)
Recommends: ca-certificates, cgroupfs-mount | cgroup-lite, git, pigz, ubuntu-fan, xz-utils, apparmor
Suggests: aufs-tools, btrfs-progs, debootstrap, docker-doc, rinse, zfs-fuse | zfsutils
Breaks: docker (<< 1.5~)
Replaces: docker (<< 1.5~)
Homepage: https://www.docker.com/community-edition
Download-Size: 25.9 MB
APT-Sources: http://ports.ubuntu.com/ubuntu-ports focal/universe arm64 Packages
Description: Linux container runtime
Docker complements kernel namespacing with a high-level API which operates at
the process level. It runs unix processes with strong guarantees of isolation
and repeatability across servers.
.
Docker is a great building block for automating distributed systems:
large-scale web deployments, database clusters, continuous deployment systems,
private PaaS, service-oriented architectures, etc.
.
This package contains the daemon and client. Using docker.io on non-amd64 hosts
is not supported at this time. Please be careful when using it on anything
besides amd64.
.
Also, note that kernel version 3.8 or above is required for proper operation of
the daemon process, and that any lower versions may have subtle and/or glaring
issues.
ubuntu@ubuntu:~$ sudo apt install --yes docker.io
ubuntu@ubuntu:~$ sudo docker version
Client:
Version: 19.03.8
API version: 1.40
Go version: go1.13.8
Git commit: afacb8b7f0
Built: Wed Mar 11 23:43:15 2020
OS/Arch: linux/arm64
Experimental: false
Server:
Engine:
Version: 19.03.8
API version: 1.40 (minimum version 1.12)
Go version: go1.13.8
Git commit: afacb8b7f0
Built: Wed Mar 11 22:48:33 2020
OS/Arch: linux/arm64
Experimental: false
containerd:
Version: 1.3.3-0ubuntu2
GitCommit:
runc:
Version: spec: 1.0.1-dev
GitCommit:
docker-init:
Version: 0.18.0
GitCommit:
7. hello-world ์ด๋ฏธ์ง ์คํ
Docker ์ค์น๊ฐ ์๋ฃ๋์์ผ๋ฏ๋ก ๋์ ํ์ธ์ ์ํด
hello-world
์ด๋ฏธ์ง๋ฅผ ์คํํด ๋ด
๋๋ค.ubuntu@ubuntu:~$ sudo docker container run --tty --rm hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
256ab8fe8778: Pull complete
Digest: sha256:8e3114318a995a1ee497790535e7b88365222a21771ae7e53687ad76563e8e76
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.
(arm64v8)
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/
์ฑ๊ณต์ ์ผ๋ก ์คํํ ์ ์์์ต๋๋ค.
Ubuntu Server์ Docker ์ค์น๋ ์ด์์ ๋๋ค.
Reference
์ด ๋ฌธ์ ์ ๊ดํ์ฌ(Raspberry Pi 4์ Ubuntu 20.04 LTS ๋ฐ Docker ์ค์น), ์ฐ๋ฆฌ๋ ์ด๊ณณ์์ ๋ ๋ง์ ์๋ฃ๋ฅผ ๋ฐ๊ฒฌํ๊ณ ๋งํฌ๋ฅผ ํด๋ฆญํ์ฌ ๋ณด์๋ค https://qiita.com/yuyakato/items/ff7b23f9cee42c937ba9ํ ์คํธ๋ฅผ ์์ ๋กญ๊ฒ ๊ณต์ ํ๊ฑฐ๋ ๋ณต์ฌํ ์ ์์ต๋๋ค.ํ์ง๋ง ์ด ๋ฌธ์์ URL์ ์ฐธ์กฐ URL๋ก ๋จ๊ฒจ ๋์ญ์์ค.
์ฐ์ํ ๊ฐ๋ฐ์ ์ฝํ
์ธ ๋ฐ๊ฒฌ์ ์ ๋
(Collection and Share based on the CC Protocol.)
์ข์ ์นํ์ด์ง ์ฆ๊ฒจ์ฐพ๊ธฐ
๊ฐ๋ฐ์ ์ฐ์ ์ฌ์ดํธ ์์ง
๊ฐ๋ฐ์๊ฐ ์์์ผ ํ ํ์ ์ฌ์ดํธ 100์ ์ถ์ฒ ์ฐ๋ฆฌ๋ ๋น์ ์ ์ํด 100๊ฐ์ ์์ฃผ ์ฌ์ฉํ๋ ๊ฐ๋ฐ์ ํ์ต ์ฌ์ดํธ๋ฅผ ์ ๋ฆฌํ์ต๋๋ค