Docker on NILFS2 filesystem (for raspbianOS)

Conclusion

--When using Docker on NILFS2 filesystem, set the storage driver to "devicemapper".

/etc/docker/daemon.json


{
  "storage-driver": "devicemapper"
}

background

The scariest thing about using the Raspberry PI 3b regularly is that the SD card suddenly breaks one day. So I converted/(rootfs) to NILFS, but docker didn't work well, so make a note of it.

Our environment

Operates only with a 32GB micro SD card. Set/dev/mmcblk0p2 to NILFS2.

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.4.79-v7+ #1373 SMP Mon Nov 23 13:22:33 GMT 2020 armv7l GNU/Linux
pi@raspberrypi:~ $ df -hT
File system type size used remaining used%Mount position
udev           devtmpfs   424M     0  424M    0% /dev
tmpfs          tmpfs       93M  8.7M   84M   10% /run
/dev/mmcblk0p2 nilfs2      30G   19G  9.6G   66% /
tmpfs          tmpfs      463M  4.0K  463M    1% /dev/shm
tmpfs          tmpfs      5.0M  4.0K  5.0M    1% /run/lock
tmpfs          tmpfs      463M     0  463M    0% /sys/fs/cgroup
/dev/mmcblk0p1 vfat       253M   68M  185M   27% /boot
tmpfs          tmpfs       93M  4.0K   93M    1% /run/user/1000
pi@raspberrypi:~ $ docker version
Client:
 Version:           18.09.1
 API version:       1.39
 Go version:        go1.11.6
 Git commit:        4c52b90
 Built:             Fri, 13 Sep 2019 10:45:43 +0100
 OS/Arch:           linux/arm
 Experimental:      false

Server:
 Engine:
  Version:          18.09.1
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.11.6
  Git commit:       4c52b90
  Built:            Fri Sep 13 09:45:43 2019
  OS/Arch:          linux/arm
  Experimental:     false

Tried storage driver

--overlay2 (default) ... △ (hello-world, busybox works, but ubuntu and large images (with multiple layers) cannot be pulled. --overlay ... × (It is said that permission is denied and it does not work at all) --vfs ... ○, but the performance is the worst. --devicemapper ... ◎. It seems to work fine.

How does devicemapper work?

It seems that a huge sparse file is created in advance, and it is cut out and used. It's refreshing to see 100G files on an SD card that is only 32GB. w

root@raspberrypi:/var/lib/docker# ls -lh devicemapper/devicemapper/data 
-rw-------1 root root 100G December 29 08:34 devicemapper/devicemapper/data

Remaining items

--Memoized the procedure to make root of Raspbian OS NILFS. (I was addicted to various places unexpectedly)

Recommended Posts

Docker on NILFS2 filesystem (for raspbianOS)
Introducing Docker Desktop for Windows on WSL2
Liberty on Docker
Redmine on Docker
Operate Docker Desktop for Windows on Linux (WSL)
When Kubernetes doesn't start on Docker Desktop for Mac
Docker installation on CentOS 6
python notes on docker
I tried using Docker Desktop for Windows on Windows 10 Home
M.S. docker on Windows
Docker installation on WSL2
Run phpunit on Docker
A story about speeding up unittest on Docker for Mac
Configuration script for using docker in proxy environment on ubuntu 20.04.1
Measures for permissions when building MySQL with Docker on WSL2
Install Docker on Raspberry Pi
Install Docker on Windows 10 PRO
Run VS Code on Docker
Install Docker on Ubuntu Server 20.04
Run openvpn on Docker (windows)
Try Docker on Windows 10 Home
Oracle Java 8 on Docker Ubuntu
Hosted Apicurio Studio on Docker
Install docker on AWS EC2
Introducing "" Monitoring Tool "" for monitoring Docker
Install docker, docker-compose for debin10
Install metrics-server with Helm on Kubernetes that comes with Docker for Mac
Create a Docker Image for redoc-cli and register it on Docker Hub