LOADING

Running n8n Locally with Docker

Running n8n Locally with Docker

Running n8n Locally with Docker

AI & Automation

8 min

2025-10-19

n8n is a powerful workflow automation tool that allows you to connect apps and services with zero or minimal code. While the n8n cloud plan requires a subscription, you can run n8n fully on your local machine using Docker for free.

Why Run n8n Locally?

  • No cloud subscription needed.
  • Complete control over data and credentials.
  • Persistent workflows and easy backups.
  • Ability to connect to local or private APIs.

Step 1: Install Docker

Before running n8n locally, ensure Docker is installed on your system:

  • Windows/macOS: Install Docker Desktop
  • Linux: Install Docker Engine using your distro's package manager

Step 2: Create a Folder for n8n Data

This ensures that your workflows and credentials persist even if the container is removed:

mkdir ~/n8n-data

Step 3: Run n8n Using Docker

Run the following command in your terminal:

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

Explanation:

  • -p 5678:5678: Access n8n UI at http://localhost:5678
  • -v ~/n8n-data:/home/node/.n8n: Store data persistently
  • --rm: Optional, removes container when stopped

Step 4: Access n8n

Open your browser and go to http://localhost:5678. You can now start creating workflows just like on the cloud.

Step 5: Optional - Using Docker Compose

For more advanced setups (persistent credentials, authentication, environment variables), create a docker-compose.yml file:

version: "3"

services:
  n8n:
    image: n8nio/n8n
    ports:
      - "5678:5678"
    volumes:
      - ./n8n-data:/home/node/.n8n
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=admin
      - N8N_BASIC_AUTH_PASSWORD=admin123

Run it with:

docker-compose up -d

Step 6: Export and Import Workflows

If your cloud plan expired but you have exported workflows, you can import them locally via the n8n UI:

  • Go to Workflows → Import
  • Select your exported JSON files
  • All workflows will run locally as they did on the cloud

Best Practices for Local n8n

  • Always use Docker volumes to persist data
  • Enable Basic Auth to secure your local instance
  • Back up ~/.n8n folder regularly
  • Use environment variables for API credentials
  • Consider using Docker Compose for complex setups

Conclusion

Running n8n locally using Docker is a simple and free alternative to the cloud plan. With persistent storage, secure credentials, and full workflow capabilities, you can continue automating your apps and services without limitations. Docker makes setup fast, portable, and easy to maintain.

Tags :

n8n

Automation

Docker

Workflow

SelfHosted

NoCloud

CI/CD

Thanks For Reading...

0%