Deploy n8n Locally & Make It Public Using Cloudflare Tunnel | Free Forever

3 min read 7 months ago
Published on Sep 01, 2025 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

In this tutorial, you'll learn how to deploy n8n locally using Docker and securely expose it to the internet using a Cloudflare Tunnel. This setup allows you to automate workflows with n8n while ensuring your instance remains accessible from anywhere, all for free. By the end of this guide, you'll have a functional n8n setup accessible via a public domain.

Step 1: Install Docker

To get started, you need Docker installed on your local machine. Follow these steps:

  1. Download Docker:

    • Go to the Docker website.
    • Choose the version compatible with your operating system (Windows, macOS, Linux).
  2. Install Docker:

    • Follow the installation instructions specific to your OS.
    • Ensure Docker is running by executing docker --version in your terminal.

Step 2: Deploy n8n Using Docker

Now that Docker is set up, you can deploy n8n.

  1. Open Terminal.

  2. Run the n8n Docker command: Use the following command to pull the n8n image and run it:

    docker run -d --name n8n -p 5678:5678 n8nio/n8n
    
    • This command runs n8n in detached mode (-d) and maps port 5678 on your local machine to port 5678 in the container.
  3. Access n8n:

    • Open your web browser and navigate to http://localhost:5678.
    • You should see the n8n interface.

Step 3: Create a Cloudflare Account

To make your local n8n instance publicly accessible, you need a Cloudflare account.

  1. Sign up for Cloudflare:

  2. Add your domain:

    • Follow the prompts to add your domain to Cloudflare.
    • Make sure your domain's DNS settings are correctly configured.

Step 4: Set Up Cloudflare Tunnel

Next, you’ll create a tunnel to expose your local n8n instance.

  1. Install Cloudflare Tunnel:

  2. Authenticate the Tunnel:

    • Run the authentication command:
    cloudflared login
    
    • This will open a browser window where you can log in to your Cloudflare account.
  3. Create a Tunnel:

    • Use the following command to create a new tunnel:
    cloudflared tunnel create n8n-tunnel
    
  4. Configure the Tunnel:

    • Create a configuration file (e.g., config.yml) with the following content:
    tunnel: YOUR_TUNNEL_ID
    credentials-file: /path/to/YOUR_TUNNEL_ID.json
    
    ingress:
      - hostname: YOUR_PUBLIC_DOMAIN
        service: http://localhost:5678
      - service: http_status:404
    
  5. Run the Tunnel:

    • Start the tunnel using the command:
    cloudflared tunnel run n8n-tunnel
    

Step 5: Access Your n8n Instance Publicly

With the tunnel running, you can now access your n8n instance via your public domain.

  1. Open Your Browser.
  2. Navigate to Your Public Domain:
    • Enter http://YOUR_PUBLIC_DOMAIN in the address bar.
    • You should see the n8n interface accessible from the internet.

Conclusion

Congratulations! You have successfully deployed n8n locally using Docker and exposed it securely to the internet with Cloudflare Tunnel. This setup allows you to leverage the powerful automation capabilities of n8n while ensuring accessibility from anywhere.

Next Steps

  • Explore n8n's features by creating workflows.
  • Consider adding more security measures, such as authentication methods.
  • Keep your Docker and Cloudflare Tunnel updated for optimal performance and security.