Files
2026-10-24 14:44:17 +03:00
..
2026-10-24 14:26:38 +03:00
2026-10-24 14:02:30 +03:00
2026-10-24 14:44:17 +03:00
2026-10-24 13:38:58 +03:00

Piwigo Docker Setup

Docker environment for running Piwigo restored from TrueNAS backup.

Quick Start

# 1. Copy environment template
cp .env.example .env

# 2. Edit .env with your database passwords
nano .env

# 3. Create data directory with correct permissions (UID 33 = www-data)
mkdir -p ./piwigo-data
chown -R 33:33 ./piwigo-data

# 4. Place your backup data in ./piwigo-data/
# Structure should be:
# piwigo-data/
#   ├── upload/          # From backup uploads/
#   ├── local/config/    # From backup config/
#   └── galleries/       # From backup galleries/ (if any)

# 5. Start containers
docker-compose up -d

# 6. Access Piwigo at http://localhost:8080

Directory Structure

ep-piwigo-docker/
├── Dockerfile              # Custom image with mariadb-client, fixed PHP settings
├── docker-entrypoint.sh    # Handles permissions, DB wait
├── docker-compose.yml      # MariaDB + Piwigo services
├── .env.example            # Environment template
└── piwigo-data/            # Your data (create this)
    ├── upload/
    ├── local/config/
    └── galleries/

Restore from Backup

After running the restore script on the Docker host, your data will be in ../piwigo-data/. You can either:

Option A: Use this directory directly

# Symlink or copy to ./piwigo-data
ln -s ../piwigo-data ./piwigo-data
docker-compose up -d

Option B: Copy to this directory

cp -r ../piwigo-data/* ./piwigo-data/
docker-compose up -d

Environment Variables

Variable Description Default
DB_ROOT_PASS MariaDB root password required
DB_NAME Database name piwigo
DB_USER Database user piwigo
DB_PASS Database user password required
PIWIGO_DATA_DIR Host data directory ./piwigo-data
PIWIGO_PORT Host port for web UI 8080

Custom Entrypoint Features

The custom docker-entrypoint.sh:

  • Fixes permissions on upload/, config/, galleries/ directories
  • Waits for database to be ready before starting Apache
  • Extracts DB config from existing config.inc.php if present

Database

Uses MariaDB 10.11. Data persisted in Docker volume db-data.

Health Checks

Both services have health checks:

  • MariaDB: mysqladmin ping
  • Piwigo: Depends on healthy DB

Logs

# View Piwigo logs
docker-compose logs -f piwigo

# View DB logs
docker-compose logs -f db

Stopping

docker-compose down

Backup (Docker-side)

# Backup database
docker-compose exec db mariadb-dump -u root -p"$DB_ROOT_PASS" piwigo > backup_$(date +%Y%m%d).sql

# Backup files
tar -czf piwigo_files_$(date +%Y%m%d).tar.gz piwigo-data/