This guide walks you through setting up ngrok to create a secure public URL, and then deploying n8n (the open-source automation tool) using Docker. Youโll end up with a live, accessible n8n instance you can connect to Gemini, Git, Slack, or any API.
ngrok allows you to securely expose your local server (like n8n) to the internet.
- ๐ง Install: https://ngrok.com/download
- ๐ Setup Guide: https://ngrok.com/docs/getting-started
Go to https://ngrok.com and sign up for a free account.
macOS
brew install ngrokLinux (Snap)
sudo snap install ngrokWindows
- Download the installer from https://ngrok.com/download
- Run the installer or unzip it to a folder added to your PATH.
After signing in, copy your Auth Token from the ngrok dashboard:
๐ https://dashboard.ngrok.com/get-started/your-authtoken
Then run:
ngrok config add-authtoken <YOUR_NGROK_AUTHTOKEN>Run:
ngrok http 5678Youโll see output similar to this:
Forwarding https://a1b2c3d4.ngrok.io -> http://localhost:5678
Copy the HTTPS URL (e.g. https://a1b2c3d4.ngrok.io).
Youโll use this as your WEBHOOK_URL in the Docker command below.
Now that ngrok is set up, letโs deploy n8n using Docker.
โ ๏ธ Replace the placeholders (<YOUR_EMAIL>,<YOUR_APP_PASSWORD>,<YOUR_NGROK_URL>) with your own values.
Never share real passwords in public repositories or slides.
docker run -it -d --rm \
--name n8n \
-p 5678:5678 \
-e GENERIC_TIMEZONE="Africa/Gaborone" \
-e TZ="Africa/Gaborone" \
-e N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true \
-e N8N_RUNNERS_ENABLED=true \
-e N8N_EMAIL_MODE=smtp \
-e N8N_SMTP_HOST="smtp.gmail.com" \
-e N8N_SMTP_PORT=465 \
-e N8N_SMTP_USER="<YOUR_EMAIL@gmail.com>" \
-e N8N_SMTP_PASS="<YOUR_APP_PASSWORD>" \
-e N8N_SMTP_SENDER="YOUR NAME <YOUR_EMAIL@gmail.com>" \
-e N8N_SMTP_SSL=true \
-e WEBHOOK_URL="<YOUR_NGROK_URL>" \
-e N8N_METRICS=true \
-e QUEUE_HEALTH_CHECK_ACTIVE=true \
-v n8n_data:/home/node/.n8n \
docker.n8n.io/n8nio/n8nThis command:
- Runs n8n in Docker
- Connects it to your ngrok public URL
- Sets up email notifications via Gmail SMTP
- Stores persistent data in
n8n_data
Once both services are running:
- Local URL: http://localhost:5678
- Public ngrok URL: Your generated HTTPS link (e.g.
https://a1b2c3d4.ngrok.io)
You can now log in and start building automations.
Stop the container:
docker stop n8nRemove persistent data (optional):
docker volume rm n8n_dataYouโve successfully:
- Installed and configured ngrok
- Created a secure tunnel for your local machine
- Deployed n8n in Docker using that tunnel
- Gained a live URL for webhook testing and AI/Gemini automations
Now you can integrate n8n with Gemini, GitHub, Google APIs, Slack, and much more!