How to Run n8n in Docker + ngrok (Complete Beginner Guide)

By - JAGGANRAJ

If you want to access your n8n workflows from anywhere in the world, running n8n with Docker and exposing it ....

If you want to access your n8n workflows from anywhere in the world, running n8n with Docker and exposing it using ngrok is one of the easiest setups.

This guide helps you:

  • Run n8n inside Docker
  • Keep workflows persistent
  • Expose n8n publicly with ngrok
  • Access workflows remotely
  • Use webhooks from Telegram, WhatsApp, APIs, etc.

Requirements

Install these first:

  • Docker Desktop
  • ngrok account

Step 1 — Install Docker

Windows

Install Docker Desktop:

Docker Desktop

After installing in cmd check version by following command:

docker --version

Ubuntu/Linux

Download Docker Desktop

Docker Desktop

Install gnome-terminal:

sudo apt install gnome-terminal

Navigate to where you download docker desktop like "/Downloads"
Install Docker:

sudo apt-get update
sudo apt install ./docker-desktop-amd64.deb

Check:

docker --version

Step 2 — Create n8n Data Folder

This stores workflows permanently.

mkdir n8n-data

Linux users:

sudo chown -R 1000:1000 n8n-data

Step 3 — Run n8n in Docker

Run this command:

docker run -it --name n8n \-p 5678:5678 \-v ./n8n-data:/home/node/.n8n \n8nio/n8n

Now open:

http://localhost:5678

You’ll see the n8n setup screen.

Step 4 — Create ngrok Account

Create free account:

ngrok Official Website

Download ngrok and install it.

Step 5 — Connect ngrok Account

Copy your auth token from dashboard.

Run:

ngrok config add-authtoken YOUR_TOKEN

Step 6 — Expose n8n Publicly

Run:

ngrok http 5678

You’ll get something like:

https://abc123.ngrok-free.app

Now anyone with this link can access your n8n instance.

Step 7 — Configure n8n for Webhooks (Important)

Without this, webhook URLs may fail.

Stop the old container:

docker stop n8ndocker rm n8n

Run again with webhook settings:

docker run -it --name n8n \-p 5678:5678 \-e WEBHOOK_URL=https://YOUR-NGROK-URL.ngrok-free.app \-v ./n8n-data:/home/node/.n8n \n8nio/n8n

Replace:

YOUR-NGROK-URL

with your actual ngrok domain.

Step 8 — Test Webhook

Create workflow:

Webhook → Respond to Webhook

Activate workflow.

Copy webhook URL.

Open it in browser.

If it responds:

Workflow executed

Everything works.

Bonus — Run n8n in Background

Instead of interactive mode:

docker run -d --restart unless-stopped \--name n8n \-p 5678:5678 \-e WEBHOOK_URL=https://YOUR-NGROK-URL.ngrok-free.app \-v ./n8n-data:/home/node/.n8n \n8nio/n8n

Official Links

Table of Contents

Happy Learning

If you found this post helpful, consider buying me a coffee! Your support helps me create more content. Thanks for being a part of this community!

Leave a Comment

Your email address will not be published. Required fields are marked *