Back to Blog

Self-Host n8n for Free with Docker Desktop (3-Minute Setup)

Automation

Run n8n locally using Docker Desktop with persistent storage. No VPS, no subscriptions, no lock-in. Step-by-step setup for Mac and Windows.

Summarize this post with

I wanted to try n8n without paying $20/month for their cloud plan or spinning up a VPS. Turns out you can run it locally through Docker Desktop in about three minutes, with all your workflows saved between restarts.

This is the setup I use for testing automations before deploying them anywhere.

If you prefer video, here's the walkthrough:

Prerequisites

  • Docker Desktop installed and running (download here)
  • About 5 minutes

That's it. No command line required for this method.

Step 1: Create a Docker Volume

Docker volumes store data that persists between container restarts. Without this, you'd lose all your workflows every time you stop n8n.

  1. Open Docker Desktop
  2. Click Volumes in the left sidebar
  3. Click Create
  4. Name it n8n-data
  5. Click Create

Step 2: Pull the n8n Image

  1. Click Images in the left sidebar
  2. Click the search bar at the top (or the "Search images to run" button)
  3. Search for n8n
  4. Find n8nio/n8n (the official image) and click Pull
  5. Wait for the download to complete, then close the search panel

Step 3: Run n8n with the Right Configuration

This is where most tutorials lose people. Here's exactly what to enter:

  1. In the Images tab, find the n8n image you just pulled
  2. Click Run
  3. Expand Optional settings and configure:

Container name: n8n

Ports:

  • Host port: 5678
  • Container port: 5678

Volumes:

  • Host path: select n8n-data (the volume you created)
  • Container path: /home/node/.n8n

Environment variables (add each key-value pair):

Variable Value Purpose
GENERIC_TIMEZONE Your timezone (e.g., America/Vancouver) Sets workflow scheduling timezone
TZ Same as above Sets system timezone
N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS true Prevents permission errors on settings file
N8N_RUNNERS_ENABLED true Enables code execution in Code nodes

Find your timezone code in the TZ database list.

  1. Click Run

You only need to configure this once. Future starts will use the same settings.

Step 4: Open n8n

After the container starts (takes a few seconds), you'll see logs in Docker Desktop. Look for a message like:

Editor is now accessible via:
http://localhost:5678

Click that link, or open http://localhost:5678 in your browser. You'll see the n8n setup screen where you can create your account.

Your account and all workflows are stored in the Docker volume, so they'll be there every time you start the container.

Starting and Stopping n8n

Once configured, managing n8n is simple:

  • Start: Go to Containers in Docker Desktop, find n8n, click the play button
  • Stop: Click the stop button
  • View logs: Click on the container name

Your workflows persist across restarts because they're stored in the volume you created.

Troubleshooting

Port 5678 already in use

Something else is running on that port. Either stop that service, or change the host port in Docker to something else (like 5679), then access n8n at http://localhost:5679.

Container starts but can't access localhost:5678

Make sure the port mapping shows 5678:5678 in the container settings. If you're on Windows, check that Docker Desktop has network access through your firewall.

Workflows disappeared after update

If you updated the n8n image and lost data, you might have accidentally created a new container without mounting the volume. Make sure your volume is attached when running a new container.

When Local Hosting Makes Sense

Running n8n locally works well for:

  • Learning n8n without spending money
  • Building and testing workflows before deploying
  • Personal automations that don't need 24/7 uptime
  • Development and prototyping

If you need workflows running while your computer is off, reliable uptime for production automations, or team collaboration, you'll eventually want a VPS or n8n's cloud service.

For now, this setup lets you build without friction.

If you're interested in local automation setups, you might also find these useful: