Docker Server on Pi - Self-hosting
Docker Server on Pi(Raspberry Pi4)
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
- Simple & clean
Raspberry pi OS install & configuration
Install pi OS
- install raspberry OS lite
- apt update && upgrade
enable ssh
sudo systemctl start ssh
sudo systemctl status ssh
sudo systemctl enable ssh
- or enable ssh headless way
- create a ssh file in root folder
- 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
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
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
- git init, git push, git clone to github
- ignore config folders
*config*/
- ignore config folders
Debuging
- check port & stop process
lsof -i:8000 #-i port number netstat -tunlp | grep 8080 # port number kill -9 PID #PID: process number
Popular Docker Apps
Host App: cockpit
sudo apt install cockpit cockpit-docker
sudo apt install firewalld #iptables 1.8.2 has bugs
- install cockpit in debian
- cockpit Boot start up
sudo systemctl enable cockpit.socket sudo systemctl status cockpit.socket
heimdall
- heimdall docker
- note: url need add http://
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
kodi-headless
- web UI
calibre-web
- calibre-web docker
- copy metadata.db to calibre-library
- login: default: admin, admin123
- chmod 777 metadata.db
- portainer
- deploy: localhsot: works!
- docker management
tips & reference
https://jackstromberg.com/2021/07/how-to-add-buster-backports-to-a-raspberry-pi/