Skip to content

A complete Docker stack for Raspberry Pi 2 W including web server, database, and various management tools.

License

Notifications You must be signed in to change notification settings

MineraleYT/pi2w-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raspberry Pi Zero 2 W Docker Stack

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!

Services

  • NGINX: Web server
  • MariaDB: Database server
  • phpMyAdmin: Database management interface
  • Pi-hole: Network-wide ad blocking
  • Portainer: Docker container management
  • Watchtower: Automatic container updates

Prerequisites

  • 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)

Quick Start

  1. Clone this repository:
git clone https://github.com/mineraleyt/pi2w-docker.git
cd pi2w-docker
  1. Create environment file:
cp .env.example .env
  1. Edit the environment file with your settings:
nano .env
  1. Make the installation script executable:
chmod +x install.sh
  1. Run the installation script:
./install.sh
  1. Start the services:
docker compose up -d

Default Ports

  • NGINX: 80
  • MariaDB: 3306
  • phpMyAdmin: 8080
  • Pi-hole: 8081 (admin interface), 53 (DNS)
  • Portainer: 9000

All ports can be customized in the .env file.

Configuration

Environment Variables

Copy .env.example to .env and configure:

  • MYSQL_ROOT_PASSWORD: MariaDB root password
  • MYSQL_DATABASE: Default database name
  • MYSQL_USER: Database user
  • MYSQL_PASSWORD: Database user password
  • PIHOLE_WEBPASSWORD: Pi-hole admin password
  • PIHOLE_TZ: Your timezone
  • Various port configurations

Service Directories

  • nginx/html: Web files
  • nginx/conf.d: NGINX configuration
  • mariadb: MariaDB data (auto-created)
  • pihole: Pi-hole configuration (auto-created)

Usage

Starting Services

docker compose up -d

Stopping Services

docker compose down

Viewing Logs

docker compose logs -f

Updating Containers

Watchtower automatically updates containers daily at 4 AM.

For manual updates:

docker compose pull
docker compose up -d

Web Interfaces

  • 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

Security Considerations

  1. Change all default passwords in .env
  2. Use strong passwords
  3. Consider enabling HTTPS
  4. Regularly update your system and containers
  5. Consider using Docker secrets for sensitive data

Backup

Database Backup

docker compose exec mariadb mysqldump -u root -p[YOUR-PASSWORD] [DATABASE] > backup.sql

Restore Database

cat backup.sql | docker compose exec -i mariadb mysql -u root -p[YOUR-PASSWORD] [DATABASE]

Troubleshooting

  1. Check service status:
docker compose ps
  1. View service logs:
docker compose logs [SERVICE_NAME]
  1. Restart a service:
docker compose restart [SERVICE_NAME]

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a new Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A complete Docker stack for Raspberry Pi 2 W including web server, database, and various management tools.

Resources

License

Stars

Watchers

Forks