A Docker-based n8n automation platform setup with automatic ngrok tunnel integration for easy webhook access and external connectivity.
Developed by: Matteo Lavaggi | 2win.agency
This project provides a complete n8n automation platform running in Docker with:
- Automatic ngrok tunnel setup for external webhook access
- Public URL generation for webhook integrations
- Easy start/stop scripts for development workflow
- Environment-based configuration with
.envfile support - Docker Desktop integration for easy container management
Perfect for developers who need to:
- Test webhooks from external services
- Share n8n workflows with team members
- Develop automation workflows that require public URLs
- Run n8n in a containerized environment
Option A: Docker Desktop (Recommended for Windows/Mac)
- Download and install Docker Desktop
- Follow the installation wizard
- Ensure Docker Desktop is running
Option B: Docker Engine (Linux)
- Follow the official Docker installation guide
- Install Docker Compose:
sudo apt-get install docker-compose-plugin
-
Download ngrok
- Visit ngrok.com/download
- Download the version for your operating system
- Extract the executable to a folder in your PATH
-
Verify Installation
ngrok version
-
Create Account
- Sign up at ngrok.com
- Verify your email address
-
Get Authentication Token
- Log in to your ngrok dashboard
- Navigate to "Your Authtoken" section
- Copy your authentication token
-
Clone or Download
git clone <repository-url> cd n8n-docker
-
Create Environment File (Optional) Create a
.envfile in the project root:NGROK_AUTHTOKEN=your_ngrok_auth_token_here
Note: If you don't create a
.envfile, the script will ask for your token each time. -
Configure Docker Compose (Optional) Review and modify
docker-compose.ymlif needed for your specific requirements.
Run the start script:
# Windows
startwithngrok.batWhat happens:
- Checks for ngrok installation
- Configures ngrok authentication (from
.envor user input) - Starts ngrok tunnel on port 5678
- Retrieves the public ngrok URL
- Updates Docker Compose with the webhook URL
- Starts the n8n container
- Displays all relevant URLs
Run the stop script:
# Windows
stopwithngrok.batWhat happens:
- Stops the n8n container (keeps it visible in Docker Desktop)
- Terminates all ngrok processes
- Optionally resets webhook URL to localhost
After starting, you can access n8n at:
- Local: http://localhost:5678
- Public: https://your-ngrok-url.ngrok-free.app (displayed in terminal)
n8n-docker/
├── docker-compose.yml # Docker Compose configuration
├── startwithngrok.bat # Start script with ngrok integration
├── stopwithngrok.bat # Stop script
├── .env # Environment variables (optional)
├── n8n.local.url # Local URL reference
├── start.bat # Basic start script (without ngrok)
└── README.md # This file
Create a .env file with the following variables:
# ngrok Configuration
NGROK_AUTHTOKEN=your_ngrok_auth_token_here
# n8n Configuration (optional)
N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=admin
N8N_BASIC_AUTH_PASSWORD=your_password_hereModify docker-compose.yml to customize:
- Port mappings
- Volume mounts
- Environment variables
- n8n configuration
ngrok not found
- Ensure ngrok is installed and in your PATH
- Try running
ngrok versionto verify installation
Docker permission denied
- On Linux, add your user to the docker group:
sudo usermod -aG docker $USER - Log out and back in for changes to take effect
Port already in use
- Check if another service is using port 5678
- Stop the conflicting service or change the port in docker-compose.yml
ngrok tunnel not working
- Verify your authtoken is correct
- Check your ngrok account limits
- Ensure you have an active internet connection
View n8n logs:
docker compose logs -fCheck ngrok status:
curl http://127.0.0.1:4040/api/tunnelsView running containers:
docker ps- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
What's covered by this license:
- The Docker Compose configuration files
- The batch scripts (
startwithngrok.bat,stopwithngrok.bat, etc.) - The project structure and documentation
- Integration logic and automation scripts
What's NOT covered by this license:
- n8n: Licensed under the n8n Sustainable Use License
- Docker: Licensed under Apache License 2.0
- ngrok: Licensed under ngrok Terms of Service
- Other third-party tools and dependencies: Each maintains its own licensing terms
This project provides integration and automation scripts only. Users must comply with the individual licenses of all underlying technologies (n8n, Docker, ngrok, etc.) when using this project.
- n8n - The workflow automation platform
- ngrok - Secure tunnel to localhost
- Docker - Containerization platform
If you encounter any issues:
- Check the troubleshooting section above
- Review the n8n documentation
- Check ngrok documentation
- Open an issue in this repository
Happy Automating! 🎉
