Install the Linux Host for your containers

As in find out what to build the choice was to go a traditional alpone linux sys instalation to run all the containers from.

Preparation

Note: I used a manual approach to create the micro-SD, you can also use Raspberry Pi Imager for more convinience

  1. Get Image from Alpine. For Pi 5 generations choose the raspberry pi aarch64 image.
  2. Install that image on an micro-SD Card. Use Ubuntu's build in "Disks" Manager tool to "restore an Image" to a drive
  3. Install the micro-SD in the Raspberry Pi,
  4. connect keyboard, monitor, network and power the system
  5. Wait until the base system is booted. If your raspberry pi does not boot, consider a cheap and incompatible micro-SD card (i had to buy twice ;))

Alpine base setup

  • Login with 'root' and no password (just hit enter) execute the installation script and enter your favorite choices setup-alpine

and follow the instructions Important choices:

  • setup a hostname to easy identify and connect your server. I chose 'rp5' for now
  • if you connected with LAN you may want to skip WLAN configuration by typing 'done' and do it later with the 'setup-interfaces'
  • you may want to setup a default user other than root to login via SSH
  • you can skip enter the ssh keys here and do it later
  • Chapter "Disk And Install"
  No disks available. Try boot media: y 
  Which disk would you like to use? : mmcblk0
  How you like to use it: sys 
  • Setup repositorys
    • use 'c' first to enable community repositories
    • use 's' to see a list of all mirrors
    • enter the mirror number close to you, e.g.'13'
  • Wait until installation is done
  • Reboot the system

Connect via SSH

Now, Alpine is reachable via SSH.
Since my plan is to use it as an headless server, I continue the installation with SSH from now on

youname@yorpc # ssh user@rp5
The authenticity of host 'rp5 (192.168.xxx.xxx)' can't be established.xxxxxxx
key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
youname@yorpc's password: 

To avoid using user/password logins, i install ssh keys instead

  1. create a ssh key pair on 'yourpc' if not already done Todo

  2. Copy your public key to the raspberry

    youname@yorpc # ssh-copy-id user@rp5

done

Customization

for more conveniance,

  • Install an easier editor than vi(m) # apk add nano

  • Install a commander filemanager for shell # apk add mc

Installing Podman (container solution)

Refer to https://wiki.alpinelinux.org/wiki/Podman and https://podman.io/

Install

switch to root user su and enter the root password install podman itself # apk add podman

podman compose # apk add podman-compose

Configuration as root

We want to run our container without root therfore we create a dedicated user 'containters' and enter a password # adduser containers

Load 'tun' kernel module for virtual network communication modprobe tun

if that works, add it permanently to load at boot echo tun >>/etc/modules

Then add the container user to subuid and subgid

# echo containers:100000:65536 >>/etc/subuid
# echo containers:100000:65536 >>/etc/subgid

Configure the podman service to run as user 'containers'

`nano /etc/conf.d/podman

 # Configuration for /etc/init.d/podman
 # See podman-system-service(1) for service description
 # and available options.
 # podman_opts="--time 0"
 # API endpoint in URI form. Leave empty to use defaults.
 # podman_uri=""
 # Setting root user will start rootful service.
 # Use any other user for rootless mode.
 podman_user="containers" 

To test Test the configuration, start service manually and # service podman start

find the socket for the podman API # find / -name podman.sock should return somthing like this /tmp/storage-run-1001/podman/podman.sock we need this information later when configuring podman-tui

Then add the service permanently to the system # rc-update add podman

restart the system # reboot

check installation

login as user 'containers' start your first container podman run --rm hello-world

In this installation all files are stored in ~/.local/share/containers

Installing podman-tui

Install podman-tui as root

Log in as root user and install podman-tui # apk add podman-tui

Configuration as user "containers"

Login as user 'container'

create/edit a podman-tui configuration

# mkdir ~/.config/podman-tui/ 
# nano ~/.config/podman-tui/podman-tui.conf
[services.localhost]
uri = "unix:/tmp/storage-run-1001/podman/podman.sock"
default = true

start podman-tui and check if its connecting to localhost

podman-tui