{"id":22691574,"url":"https://github.com/nilsstreedain/rpi-docker-server-setup","last_synced_at":"2025-04-12T23:10:25.387Z","repository":{"id":133715926,"uuid":"402287161","full_name":"nilsstreedain/RPi-Docker-Server-Setup","owner":"nilsstreedain","description":"Instructions for my Simple Raspberry Pi Docker Setup, also configures Pi-Hole with auto-updating blocklists and DoH (using Cloudflared)","archived":false,"fork":false,"pushed_at":"2024-04-08T23:15:36.000Z","size":65,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T17:11:21.574Z","etag":null,"topics":["raspberry-pi","raspberrypi","raspbian"],"latest_commit_sha":null,"homepage":"https://www.nilsstreedain.com/blog/2021/09/01/setting-up-raspberry-pi-docker-server","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nilsstreedain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-02T04:18:52.000Z","updated_at":"2024-12-31T00:51:47.000Z","dependencies_parsed_at":"2024-04-09T00:26:46.042Z","dependency_job_id":"3c29796b-94fa-4e8f-8184-f9469612e83f","html_url":"https://github.com/nilsstreedain/RPi-Docker-Server-Setup","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilsstreedain%2FRPi-Docker-Server-Setup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilsstreedain%2FRPi-Docker-Server-Setup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilsstreedain%2FRPi-Docker-Server-Setup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilsstreedain%2FRPi-Docker-Server-Setup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nilsstreedain","download_url":"https://codeload.github.com/nilsstreedain/RPi-Docker-Server-Setup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248643004,"owners_count":21138355,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["raspberry-pi","raspberrypi","raspbian"],"created_at":"2024-12-10T01:11:37.175Z","updated_at":"2025-04-12T23:10:25.362Z","avatar_url":"https://github.com/nilsstreedain.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# RPi-Docker-Server-Setup\nBefore getting started\n- Create a fresh install of Raspberry Pi OS with ssh enabled (add an empty file named ssh to the boot folder)\n- Connect the Raspberry Pi to your network (make sure to use a trunk port and assign a static IP)\n- ssh into the Pi\n\n## Prepare Raspberry Pi\nChange default user password\n```bash\npasswd\n```\n\nUpdate Raspberry Pi\n```bash\nsudo apt update\n```\n\n```bash\nsudo apt full-upgrade\n```\n\nOpen raspberry pi configuration\n```bash\nsudo raspi-config\n```\n\nChange Raspberry Pi Hostname (`raspi-config` \u003e `System Options` \u003e `Hostname`)\n\nSet Raspberry Pi Country (`raspi-config` \u003e `Localisation Options` \u003e `WLAN Country`)\n\nComplete Set Up (`Finish` \u003e `Would you like to reboot now?` \u003e `Yes`)\n\n## Setup non-default user\n### Enable root SSH (If headless)\nEnable root password\n```bash\nsudo passwd root\n```\n\nEdit SSH congif\n```bash\nsudo nano /etc/ssh/sshd_config\n```\n\nModify `#PermitRootLogin prohibit-password` to:\n```\nPermitRootLogin yes\n```\n\nRestart SSH\n```bash\nsudo systemctl restart sshd\n```\n\n### Rename pi user\nLogin to root account\n```bash\nssh root@raspberrypi\n```\n\nChange pi username (Replace nilsstreedain with the username you'd like to use)\n```bash\nusermod -l nilsstreedain pi\n```\n\nChange home directory name (Replace `nilsstreedain` with the username you'd like to use)\n```bash\nusermod -m -d /home/nilsstreedain nilsstreedain\n```\n\nLogout of root account\n```bash\nlogout\n```\n\n## SSH Authentication With Public/Private Key Pair Instead of Password\n### On Raspberry pi\nCreate public key directory\n```bash\nmkdir ~/.ssh \u0026\u0026 chmod 700 ~/.ssh\n```\n\n### On Mac\nGenerate Public/Private Key Pair\n```bash\nssh-keygen -b 4096\n```\n\nUpload Public key from Mac to Linux (Replace `nilsstreedain` with the username you'd like to use)\n```bash\nscp ~/.ssh/id_rsa.pub nilsstreedain@raspberrypi:~/.ssh/authorized_keys\n```\n\n### Disable root password\nDiable root password\n```bash\nsudo passwd -l root\n```\n\nDisable ssh for root. Edit SSH congif\n```bash\nsudo nano /etc/ssh/sshd_config\n```\n\nModify `PermitRootLogin yes` to:\n```\n#PermitRootLogin prohibit-password\n```\n\nAlso disable ssh authentication with password. Modify `#PasswordAuthentication yes` to:\n```\nPasswordAuthentication no\n```\n\nRestart SSH\n```bash\nsudo systemctl restart sshd\n```\n\n## Setup Auto-Updtaes\nInstall Unattanded Upgrades\n```bash\nsudo apt-get install unattended-upgrades\n```\n\nStart Unattended Upgrades\n```bash\nsudo dpkg-reconfigure --priority=low unattended-upgrades\n```\n\n## Setup Firewall\nInstall Uncomplicated Firewall\n```bash\nsudo apt install ufw\n```\n\nAllow TCP on port 22 for SSH\n```bash\nsudo ufw allow 22/tcp\n```\n\nEnable Firewall\n```bash\nsudo ufw enable\n```\n\n## Setup VLANs\nInstall vlan package\n```bash\nsudo apt install vlan\n```\n\nCreate network interface config file for vlans\n```bash\nsudo nano /etc/network/interfaces.d/vlans\n```\n\nConfigure vlan interfaces by adding\n```\nauto eth0.16\niface eth0.16 inet manual\n  vlan-raw-device eth0\n ```\n\nRestart pi's networking\n```bash\nsudo systemctl restart networking\n```\n\nTest config for an IP in each vlan\n```bash\nhostname -I\n```\n\n## Setup Docker\nInstall dependencies\n```bash\nsudo apt-get install curl git\n```\n\nInstall Docker\n```bash\nbash -c \"$(curl -fsSL https://get.docker.com)\"\n```\n\nTest Docker\n```bash\nsudo docker run --rm hello-world\n```\n\nInstall Docker Compose\n```bash\nsudo apt-get -y install docker-compose-plugin\n```\n\n## Setup Pi-Hole\nCreate a directory to setup Pi-Hole with Auto-Updating Blocklists\n```bash\nmkdir pihole pihole/etc-pihole-updatelists \u0026\u0026 cd pihole\n```\n\nCopy the pihole-updatelists config file to configure pihole-updatelists\n```bash\nsudo wget https://raw.githubusercontent.com/nilsstreedain/RPi-Docker-Server-Setup/main/pihole/pihole-updatelists/pihole-updatelists.conf -O etc-pihole-updatelists/pihole-updatelists.conf\n```\n\nCopy the docker-compose file to configure cloudflared, pi-hole, pihole-updatelists, and their respective networking\n```bash\nsudo wget https://raw.githubusercontent.com/nilsstreedain/RPi-Docker-Server-Setup/main/pihole/docker-compose.yml -O docker-compose.yml\n```\n\nRun docker-compose\n```bash\nsudo docker compose up -d\n```\n\nSet Pi-Hole password\n```bash\nsudo docker exec -it pihole sudo pihole -a -p\n```\n\n### Updating Pi-Hole and other Docker containers\nWhen you need to update Pi-Hole, ssh into the raspberry pi and navigate to ~/pihole\n```bash\ncd ~/pihole\n```\n\nPull the latest Pi-Hole docker updates\n\n```bash\nsudo docker pull jacklul/pihole\n```\n\n\u003c!--\n```bash\nsudo docker pull pihole/pihole \u0026\u0026 sudo docker pull jacklul/pihole\n```\n--\u003e\n\nThen re-run docker-compose to build and run the new updated containers\n```bash\nsudo docker compose up -d --force-recreate\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilsstreedain%2Frpi-docker-server-setup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnilsstreedain%2Frpi-docker-server-setup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilsstreedain%2Frpi-docker-server-setup/lists"}