DOCKER_COMPOSE_SETUP.md
This setup uses serversideup/php:8.4-fpm-nginx as the base image and is designed to work behind a reverse proxy like Cloudflare Tunnel, or Nginx (Proxy Manager) for HTTPS termination.
Clone and prepare the privledges
git clone https://github.com/pixelfed/pixelfed
cd pixelfed
sudo chown -R www-data:www-data storage/ bootstrap/cache/
Copy the environment file:
cp .env.docker.example .env
Update .env with your configuration:
APP_KEY ( generate with https://laravel-encryption-key-generator.vercel.app/ )APP_URL, APP_DOMAIN, ADMIN_DOMAIN, SESSION_DOMAIN with your domainDB_PASSWORD and DB_ROOT_PASSWORDBuild container
docker compose build
open /home/username/pixelfed/storage/app/public/m/_v2/xxxxxxxxxxxxxxxxxx/xxxxxxxxxxx-xxxxxxxxxx/xxxxxxxxxxxx: permission denied or similar might require fixing local permissions.
sudo find storage/ -type d -exec chmod 755 {} \; # set all directories to rwx by user/group
sudo find storage/ -type f -exec chmod 644 {} \; # set all files to rw by user/group
Build and start the containers:
docker compose up -d db redis # Bootstrap the database and Redis.
# Wait 30 seconds for them to complete first boot.
docker compose up -d
Generate application keys (Critical for Federation) and other tasks:
docker compose exec pixelfed php artisan instance:actor
docker compose exec pixelfed php artisan import:cities
docker compose exec pixelfed php artisan passport:keys
Create admin user:
docker compose exec pixelfed php artisan user:create
pixelfed.yourdomain.com)httppixelfed-app (or the Docker host IP)8080client_max_body_size 500M;
proxy_read_timeout 300s;
server {
listen 443 ssl http2;
server_name yourdomain.com;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;
client_max_body_size 500M;
location / {
proxy_pass http://localhost:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 300s;
}
}
# View logs
docker compose logs -f
# Run artisan commands
docker compose exec pixelfed php artisan [command]
# Access container shell
docker compose exec pixelfed bash
# Restart services
docker compose restart
# Stop services
docker compose down
# Stop and remove volumes (WARNING: deletes data)
docker compose down -v