Self-Host n8n for FREE with Docker & Ngrok
3 min read
7 months ago
Published on Aug 31, 2025
This response is partially generated with the help of AI. It may contain inaccuracies.
Table of Contents
Introduction
This tutorial will guide you through the process of self-hosting n8n, an open-source workflow automation tool, using Docker and Ngrok for free. By following these steps, you'll set up your own automation server, enabling you to create workflows for tasks like managing Telegram messages or automating social media posts without incurring any costs.
Step 1: Install Docker and Ngrok
-
Install Docker
- Visit the Docker website and follow the installation instructions for your operating system.
- Ensure Docker is running by executing
docker --versionin your terminal.
-
Install Ngrok
- Go to the Ngrok website and download the appropriate version for your OS.
- Unzip the downloaded file and move it to a directory in your PATH, or follow the installation instructions provided on the site.
Step 2: Pull the n8n Docker Image
- Open your terminal.
- Run the following command to pull the n8n Docker image:
docker pull n8n
Step 3: Authenticate Ngrok
- Sign up for a free Ngrok account at Ngrok.
- After signing in, obtain your authentication token from the dashboard.
- In your terminal, run the following command to authenticate Ngrok:
ngrok authtoken YOUR_AUTH_TOKEN- Replace
YOUR_AUTH_TOKENwith the token you copied from the Ngrok dashboard.
- Replace
Step 4: Claim a Free Static Domain
- After authentication, run the following command to expose your local server:
ngrok http 5678 - This command will provide you with a public URL. Save this URL, as you'll need it later for webhooks.
Step 5: Set Up Port, Folder, and Volume Mount
- Create a folder on your local machine for n8n data:
mkdir -p /home/node/.n8n - Note the path, as you will use it in the Docker command.
Step 6: Set Environment Variables
- You need to configure n8n with certain environment variables. Use the following variables:
export EDITOR_BASE_URL=YOUR_NGROK_URL export WEBHOOK_URL=YOUR_NGROK_URL/webhook export N8N_DEFAULT_BINARY_DATA_MODE=filesystem export N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true export N8N_RUNNERS_ENABLED=true- Replace
YOUR_NGROK_URLwith the public URL you obtained in Step 4.
- Replace
Step 7: Run the n8n Container
- Run the following Docker command to start the n8n container:
docker run -d -p 5678:5678 \ -v /home/node/.n8n:/home/node/.n8n \ -e EDITOR_BASE_URL=$EDITOR_BASE_URL \ -e WEBHOOK_URL=$WEBHOOK_URL \ n8n
Step 8: Access the n8n Dashboard
- Open your web browser and go to
http://localhost:5678. - You should see the n8n dashboard where you can start creating workflows.
Step 9: Test Webhook with Ngrok Domain
- Create a new workflow in n8n.
- Set up a webhook node and use the URL
YOUR_NGROK_URL/webhook. - Test the webhook by triggering it from a third-party service or using a tool like Postman.
Conclusion
You have successfully self-hosted n8n using Docker and Ngrok. This setup allows you to create unlimited automation workflows without any cost. Now you can explore the various integrations and functionalities that n8n offers. If you encounter any issues, feel free to reach out in the comments or consult the n8n documentation for further assistance. Happy automating!