Skip to content

Cub0n/RaspberryPI-and-Container-configurations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Contribution rules

If you want to contribute to this list, create a PR (Pull Request) with description what you are adding. The following rules should be addressed:

  • Clear description
  • Keep it simple and stupid (KISS)
  • Only use active open-source software and images
  • Configuration/Enhancements have to be tested or should be annotated as NOT TESTED

This is an ongoing work and is not yet finished!!

Topics

The operating system should be leightweight: No GUI ("headless"), no multimedia stuff, no "fat" applications or services. A good overview is here.

Raspbian / Debian / DietPI

OS

AppArmor

SELinux

NOT TESTED

Firewall

iptables/netfilter

ufw

firewalld

apf (NOT TESTED)

Runtime Plattforms

Docker

Installation on various OS (https://docs.docker.com/engine/install/). Often included in distribution package repositories.

k3s / k3d

minikube / kubernetes (k8s)

Installation is done via shell script (https://minikube.sigs.k8s.io/docs/start/). Works only on ARM64 (RaspberryPI 4) systems.

MicroK8s

Ubuntu's own minikube (https://ubuntu.com/tutorials/how-to-kubernetes-cluster-on-raspberry-pi)

Podman

Installation on various OS (https://podman.io/getting-started/installation). Often included in distribution package repositories.

nerdctl (NOT TESTED)

https://github.com/containerd/nerdctl

DOKKU

see https://github.com/dokku/dokku. Some Buildpacks are not working on RaspberryPi2 (e.g. Herokuish)

Caprover

see https://caprover.com/. SideNote: Caprover will not work properly if it is started in (rootless-)podman

Rootless Container

see https://rootlesscontaine.rs/

Docker (NOT TESTED)

Docker Rootless is not supported or available as package in Raspbian. Therefore you have to install and configure it manually:

Podman (on Debian 12 Bookworm)

$ sudo apt install podman
  • Install uidmap from the repo
$ sudo apt install uidmap
  • Add a new user for rootless container. Username and groupname should be identical (otherwise it leads to some problems for subuid and subgid). Create the user with no password and no valid shell! DO NOT add the user to sudo group or to other system groups. The subuids and subgids should automatically be generated. If not, see https://rootlesscontaine.rs/getting-started/common/subuid/
$ sudo apt install adduser
$ sudo addgroup $GROUP
$ sudo adduser --home /home/$USER --shell /bin/nologin --ingroup $GROUP --disabled-password --disabled-login $USER
  • Keep the daemons alive
$ sudo loginctl enable-linger $USER
  • login to new $USER
$ sudo su --shell /bin/bash --login $USER
$ systemctl --user set-environment XDG_RUNTIME_DIR=/run/user/$UID
$ systemctl --user set-environment DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus"
  • Enable podman socket for the current user
$ systemctl --user --now enable podman.socket
  • Daemon restart
$ systemctl --user daemon-reload
  • Test the unix socket and expect OK as reponse
$ curl --unix-socket /run/user/$UID/podman/podman.sock http://localhost/_ping
  • If you have an older images, you have to migrate them to the new runtime (default is crun on Debian)
$ podman system migrate --new-runtime crun
  • If the containers will not start after migration, one trick is to delete all images and pull them again
$ podman system prune --all
  • Logout from $USER
$ exit
  • If there are still some problems, review your configuration in ~/.config/containers/ (if you have already one for $USER) or under /etc/containers/ and /etc/containers/networks/

Configuration

  • Copy the container and storage configuration to the $USER ~/.config directory
$ cp /usr/share/containers/containers.conf ~/.config/containers/
$ cp /usr/share/containers/storage.conf ~/.config/containers/
  • Configure containers.conf with

    • network_backend = "netavark" (the default container network stack)
    • runtime = "crun" (default runtime)
    • cgroup_manager = "systemd" (for usage with systemd)
  • Configure storage.conf

    • driver = "overlay" (Default Storage Driver)
    • runroot = "/run/user/$UID/containers" (Temporary storage location)
    • mount_program = "/usr/bin/fuse-overlayfs" (Path to an helper program to use for mounting the file system, programm will be installed automatically by apt)

Migrate from podman start to systemd start

Running podman containers can be started/stopped with systemd. To enable this, some commands have to be done for every container. This script makes it a little bit more automatic.

Automatic Updates of containers

Every container (which should be automatically updated) needs a label="io.containers.autoupdate=registry".

Further Documentation

TODO