Official Docker Image
Pterodactyl provides an official Docker image hosted on GitHub Container Registry:- Based on PHP 8.3 FPM Alpine
- Includes Nginx web server
- Node.js 22 for asset compilation
- Built-in cron and supervisor
- Multi-architecture support (AMD64, ARM)
Docker Compose Setup
Basic Configuration
Create adocker-compose.yml file:
Environment Variables
Application Settings
Database Configuration
Cache Configuration
Mail Configuration
Dockerfile Structure
The official Pterodactyl Dockerfile uses a multi-stage build:Stage 0: Asset Compilation
- Uses Node.js 22 to compile frontend assets
- Runs
yarn installto get dependencies - Builds production assets with
yarn run build:production
Stage 1: Application Container
- Uses PHP 8.3 FPM on Alpine Linux
- Copies compiled assets from Stage 0
- Installs required system packages
- Includes certbot for Let’s Encrypt SSL
PHP Extensions
bcmath- Arbitrary precision mathematicsgd- Image processingpdo_mysql- MySQL database driverzip- Archive handling
Application Setup
Volume Mounts
Persistent Data
Mount these directories to persist data across container restarts:Directory Permissions
Ensure proper permissions on mounted directories:SSL/TLS Configuration
Let’s Encrypt (Automatic)
Set theLE_EMAIL environment variable:
- Request a certificate from Let’s Encrypt
- Configure Nginx to use HTTPS
- Set up auto-renewal via cron (runs at 11 PM daily)
Custom Certificates
Mount your certificates to/etc/letsencrypt/:
fullchain.pem- Certificate chainprivkey.pem- Private key
Networking
Port Exposure
Custom Network
Reverse Proxy
When using a reverse proxy (Nginx, Traefik, Caddy):- Don’t expose ports 80/443
- Set
APP_URLto your domain - Configure proxy to pass headers:
Cron Jobs
The container automatically sets up cron jobs:Supervisor Configuration
The container uses Supervisor to manage processes:Starting the Stack
Initial Setup
After starting the containers, run the setup:Maintenance Commands
Clear Cache
Update Panel
Troubleshooting
Container Won’t Start
Check logs:- Database not ready (wait a few seconds)
- Permission errors on volumes
- Port conflicts
Database Connection Failed
Verify:- Database container is running
- Credentials match in both services
- Database has been created
Permission Errors
Best Practices
- Use environment files for sensitive data
- Enable HTTPS for production
- Regular backups of mounted volumes
- Monitor logs for errors
- Keep images updated for security
- Use Redis for cache and sessions
- Configure proper memory limits for PHP-FPM
