A complete Docker stack for Raspberry Pi Zero 2 W including web server, database, and various management tools.
🔍 Live Preview - See the stack in action before installing!
- NGINX: Web server
- MariaDB: Database server
- phpMyAdmin: Database management interface
- Pi-hole: Network-wide ad blocking
- Portainer: Docker container management
- Watchtower: Automatic container updates
- Raspberry Pi Zero 2 W with Raspberry Pi OS installed
- Git installed (
sudo apt-get install git) - Internet connection
- SSH access to your Raspberry Pi (recommended)
- Clone this repository:
git clone https://github.com/mineraleyt/pi2w-docker.git
cd pi2w-docker- Create environment file:
cp .env.example .env- Edit the environment file with your settings:
nano .env- Make the installation script executable:
chmod +x install.sh- Run the installation script:
./install.sh- Start the services:
docker compose up -d- NGINX: 80
- MariaDB: 3306
- phpMyAdmin: 8080
- Pi-hole: 8081 (admin interface), 53 (DNS)
- Portainer: 9000
All ports can be customized in the .env file.
Copy .env.example to .env and configure:
MYSQL_ROOT_PASSWORD: MariaDB root passwordMYSQL_DATABASE: Default database nameMYSQL_USER: Database userMYSQL_PASSWORD: Database user passwordPIHOLE_WEBPASSWORD: Pi-hole admin passwordPIHOLE_TZ: Your timezone- Various port configurations
nginx/html: Web filesnginx/conf.d: NGINX configurationmariadb: MariaDB data (auto-created)pihole: Pi-hole configuration (auto-created)
docker compose up -ddocker compose downdocker compose logs -fWatchtower automatically updates containers daily at 4 AM.
For manual updates:
docker compose pull
docker compose up -d- Main Page:
http://[YOUR-PI-IP] - Portainer:
http://[YOUR-PI-IP]:9000 - phpMyAdmin:
http://[YOUR-PI-IP]:8080 - Pi-hole:
http://[YOUR-PI-IP]:8081/admin
- Change all default passwords in
.env - Use strong passwords
- Consider enabling HTTPS
- Regularly update your system and containers
- Consider using Docker secrets for sensitive data
docker compose exec mariadb mysqldump -u root -p[YOUR-PASSWORD] [DATABASE] > backup.sqlcat backup.sql | docker compose exec -i mariadb mysql -u root -p[YOUR-PASSWORD] [DATABASE]- Check service status:
docker compose ps- View service logs:
docker compose logs [SERVICE_NAME]- Restart a service:
docker compose restart [SERVICE_NAME]- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.