Docker Server on Pi(Raspberry Pi4)

raspberrypi NAS

There are lots of interesting self-host solutions: Yunohost, Sandbox, Freedom Box, HomeLabOS and more. After tested some solution, it seems the pure Docker solution on Raspberry is my best choice:

  • Raspberry Pi4: low cost popular open source hardware, fit family self-hosting.
  • Docker compose:
    • Simple & clean
      • Pure Raspberry Pi OS;
      • Simple setup: script and git auto setup and sync ssh, python-3, docker, docker-compose.
      • 1 Docker 1 App. Up/Down completely, no harm.
      • Many mature docker images & Apps with Web UI.
    • Customize
      • docker-compose parameters can config easily.
    • Security

Raspberry pi OS install & configuration

Install pi OS

  1. install raspberry OS lite
  2. apt update && upgrade

enable ssh

sudo systemctl start ssh

sudo systemctl status ssh
sudo systemctl enable ssh
  1. or enable ssh headless way
    • create a ssh file in root folder
  2. set password
sudo passwd <USERNAME> # username root; current user leave blank

mount external USB drive(auto mount)

  • note: mount usb drive
    sudo fdisk -l
    sudo mount /dev/sda1 /mnt
    
sudo mkdir /media/extdisk
ls -l /dev/disk/by-uuid
sudo nano /etc/fstab ## UUID=1610029410027ACF /media/extdisk auto nofail,uid=33,gid=33,noatime 0 0
sudo umount /dev/sda1
sudo mount -a
sudo reboot

mount USB drive

Install Docker & Docker-compose

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
docker version
docker run hello-world

sudo apt-get install libffi-dev libssl-dev
sudo apt install python3-dev
sudo apt-get install -y python3 python3-pip

sudo pip3 install docker-compose

patch for libseccomp

    wget http://ftp.us.debian.org/debian/pool/main/libs/libseccomp/libseccomp2_2.4.4-1~bpo10+1_armhf.deb
    sudo dpkg -i libseccomp2_2.4.4-1~bpo10+1_armhf.deb

install docker install issues debug docker install overlay issues

docker-compose commands

nano docker-compose.yml
docker-compose up -d
docker-compose down
docker-compose logs

-v /etc/localtime:/etc/localtime:ro

Backup and sync config files

  1. git init, git push, git clone to github
    • ignore config folders *config*/

Debuging

  1. check port & stop process
    lsof -i:8000 #-i port number
    netstat -tunlp | grep 8080 # port number
    kill -9 PID #PID: process number
    

Host App: cockpit

sudo apt install cockpit cockpit-docker
sudo apt install firewalld #iptables 1.8.2 has bugs

heimdall

samba

  • samba docker
  • note: support SMB1
    sudo docker exec -i -t samba_samba_1 /bin/bash
    vi /etc/samba/smb.conf
    server min protocol = LANMAN1 #change not add new line
    

    -I Add an include option at the end of the smb.conf

jellyfin

emby

transmission

syncthing

nextcloud

  • official docker?

Testing Apps

piwigo

install guide

kodi-headless

  • web UI

calibre-web

  1. portainer
    • deploy: localhsot: works!
    • docker management

tips & reference

https://jackstromberg.com/2021/07/how-to-add-buster-backports-to-a-raspberry-pi/