This repository contains a Docker setup to run n8n — an extendable workflow automation tool.
This setup builds a container using the official n8nio/n8n:latest image, with basic authentication enabled and PostgreSQL as the database.
.
├── Dockerfile
├── .env
├── docker-compose.yml
└── README.md
Add your environment variables in a .env file:
# Required
DB_TYPE=postgres
DB_POSTGRESDB_URL=postgres://user:pass@your-host.com:5432/postgres
# Optional: Basic Auth
N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=<adminuser>
N8N_BASIC_AUTH_PASSWORD=<adminpassword>
# Optional: Port
PORT=8080Replace
user,pass,your-host.com, and<adminuser>/<adminpassword>with your actual credentials.
FROM n8nio/n8n:latest
ENV PORT=8080
ENV N8N_PORT=$PORT
EXPOSE 8080services:
app:
build:
context: .
dockerfile: Dockerfile
ports:
- "8080:8080"
env_file:
- .envBuild and start the container:
docker-compose up --buildVisit the app at: http://localhost:8080
Basic authentication is enabled if N8N_BASIC_AUTH_ACTIVE=true. Use the credentials from the .env file to log in.
docker-compose down