A standalone Docker setup for Invoice Ninja with Nginx and Supervisor.
-
Copy the environment file and configure it:
cp .env.example .env
-
Generate a new APP_KEY: First start the containers temporarily to generate the key:
docker compose up -d docker exec invoiceninja php /var/www/html/artisan key:generate --showCopy the generated key and add it to your
.envfile asAPP_KEY=base64:... -
Edit
.envwith your settings:- Set
APP_URLto your domain - Set the generated
APP_KEY - Configure mail settings
- Set initial admin credentials (
IN_USER_EMAILandIN_PASSWORD)
- Set
-
Rebuild and start the containers:
docker compose down -v docker compose up -d
-
Access Invoice Ninja:
- Default: http://localhost:7077
- Use wizard for setup
- invoiceninja: Main application container (PHP-FPM + Nginx + Queue Worker)
- ninjadb: MySQL 8 database
app_data_invoiceninja: Application data and storagedb_data_invoiceninja: MySQL database files
Dockerfile: Builds the Invoice Ninja container with Nginx and Supervisordocker-compose.yml: Orchestrates the servicesnginx.conf: Nginx web server configurationsupervisord.conf: Supervisor process manager configurationdocker-entrypoint.sh: Container initialization scriptplugins/: Custom blade templates and HTML files
The plugins/ folder contains custom files that are mounted into the container:
index.blade.php: Custom React view templatesettoken.html: Token setting utility
Key environment variables in .env:
| Variable | Description |
|---|---|
APP_URL |
Your Invoice Ninja URL |
APP_KEY |
Laravel application key |
DB_HOST |
Database hostname (default: ninjadb) |
DB_DATABASE |
Database name |
DB_USERNAME |
Database user |
DB_PASSWORD |
Database password |
MAIL_* |
SMTP mail configuration |
docker compose logs -f invoiceninjadocker compose exec invoiceninja bashdocker compose exec invoiceninja php /var/www/app/artisan <command>docker compose exec ninjadb mysqldump -u ninja -pninja ninja > backup.sqldocker compose downTo remove volumes as well:
docker compose down -v