As a powerful open-source workflow automation tool running locally or in own server free of charge brings huge value to build future projects!
For more info check the website https://docs.n8n.io/ otherwise lets get started! 🏁🏁🏁
Docker Setup
To run locally you just need a simple Docker command.
# Build image
docker build -t my-n8n .
# Run container
docker run -it --rm \
--name n8n \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
n8nio/n8n
Here, --name sets the container name, -p maps the port, and -v ensures your workflows are saved persistently."
Then in some time(because the size is 1.3GB) it should run and in the localhost port will see above internal sign in.
And that's practically it and you can start building your workflows!
Just don't rebuild the image without saving the volumes as you may delete them as I have before!
Webhooks & ngrok
Locally if you want n8n to communicate with external applications Webhook needs to work, and for that ngrok is required.
ngrok exposes your local n8n instance to the internet, so external apps can reach your webhooks.
Once a domain has been created and API key shared the docker file would be better to be replaced with docker-compose.yml file.
version: '3.8'
services:
n8n:
image: n8nio/n8n:latest
ports:
- "5555:5678"
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=your-secure-password
- N8N_HOST=0.0.0.0
- N8N_PORT=5678
volumes:
- n8n_data:/home/node/.n8n
ngrok:
image: ngrok/ngrok:latest
command: ["http", "n8n:5678"]
environment:
- NGROK_AUTHTOKEN=your-ngrok-authtoken
ports:
- "4040:4040"
depends_on:
- n8n
volumes:
n8n_data:
Then ones this is done and rebuild you can use Webhooks. 💪
Server setup
On a VPS with a public IP or domain, you don't need ngrok. Just point your DNS to the server and configure n8n with your domain.
As well let's then use compose file docker-compose.server.yml (tweak N8N_HOST to your domain):
version: '3.8'
services:
n8n:
image: n8nio/n8n:latest
ports:
- "5555:5678"
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=your-secure-password
- N8N_HOST=0.0.0.0
- N8N_PORT=5678
volumes:
- n8n_data:/home/node/.n8n
ngrok:
image: ngrok/ngrok:latest
command: ["http", "n8n:5678"]
environment:
- NGROK_AUTHTOKEN=your-ngrok-authtoken
ports:
- "4040:4040"
depends_on:
- n8n
volumes:
n8n_data:
The restart: always ensures n8n restarts automatically if the server reboots.
And run docker compose -f docker-compose.server.yml up -d.
Whether you're experimenting locally or deploying on a VPS, n8n gives you full control over your workflows. With Docker Compose, you can scale easily, secure your instance, and connect to external apps. Start building your automations today - without subscription costs.


Top comments (0)