A Step-by-Step Guide to Installing n8n Locally Using Docker

18 December 2025 , , ,

An Introduction to n8n and Docker

n8n is an open-source workflow automation tool that enables users to connect various services and automate tasks without extensive coding knowledge. It operates on a modern, visual interface, allowing users to create intricate workflows by simply dragging and dropping components. With hundreds of integrations, n8n provides flexibility and power, catering to a wide range of automation needs, from data transfer between applications to complex business processes.

One of the most significant advantages of n8n is its self-hosting capability, which grants users complete control over their workflows and data. By hosting n8n locally, you’re in control over your own data, privacy and if you already have the hardware to run it, it’s free.

You can install N8N locally, but it’s much cleaner and easier to install it inside Docker. Docker serves as an effective container based platform, which allows developers to package applications and their dependencies into containers, ensuring consistent execution across different environments.

Prerequisites for installing N8N locally in Docker

Before proceeding with the installation of n8n you will obviously need docker desktop installed and running. To install Docker, users can visit the official Docker website and follow the instructions that correspond to their operating system (Windows, macOS, or Linux).

In addition to Docker, Docker Compose must also be installed, and this comes as part of the Docker Desktop application.

How to install N8N locally in Docker

Installing n8n locally with Docker requires a small number of fairly straight forward steps. For this guide, I am using a Mac, but you can do this on Windows or Linux with the same configuration. I’m just using a Mac as that’s what I use to run many of my containerised applications. I did consider a Raspberry Pi, as I also use those too, but went with the Mac so I have more power to throw at some of the automations in the future, including utilising local LLMs.

Let’s get started:

1) Open Docker Desktop.

2) Decide where you want to store your n8n data. I’m using /docker/docker-containers-macosx/n8n withing my user folder (it’s not the perfect folder, but it is what it is and I have my reasons, just don’t ask).

3) Create that folder.

4) Create a plain text file in that folder called docker-compose.yml and add the below content, replacing <your_domain_or_ip> with your machines local IP address or machine name, N8N_ENCRYPTION_KEY with a password of your choice which will be used to encrypt your data.

YAML
services:
  n8n:
    image: n8nio/n8n:latest 
    container_name: n8n
    restart: unless-stopped
    ports:
      - "5678:5678" 
    environment:
      - GENERIC_TIMEZONE=Europe/London
      - N8N_HOST=<your_domain_or_ip>
      - N8N_PORT=5678
      - N8N_PROTOCOL=http
      - N8N_SECURE_COOKIE=false
      - N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
      - N8N_ENCRYPTION_KEY=<your_encryption_key>
    volumes:
      # Keeps all your N8N data (credentials, workflows, etc) persistent
      - ./n8n_data:/home/node/.n8n

You can track changes to the docker compose code, in case I update them via my GitHub repo

5) Save the file

6) Open a Terminal windows and navigate to the folder you created, which should have the docker-compose.yml file that you just created.

7) Run the below command to invoke docker compose and push your n8n container to docker

Bash
docker-compose up -d

You will see the latest version of n8n download locally to your machine.

After it’s downloaded, it will be pushed to docker.

8) Return to Docker Desktop and verify that the container is running.

With these steps completed, n8n should be successfully running on your local machine, and you can access it through your web browser at the specified port, usually localhost:5678 unless otherwise changed by you. Now the fund starts.

Verifying Your Installation

Once you have successfully installed n8n using Docker, the next crucial step is to verify that the application is running correctly within your Docker environment. To do this, you will begin by accessing n8n through your web browser. Start by opening your preferred web browser and entering the following URL: http://localhost:5678 or http://YOUR_IP_ADDRESS:5678. This is your computers IP address, not the IP address of the container. If everything has been set up properly, this should take you to the n8n user interface.

If you see an n8n interface, then you are up and can start configuring your n8n instance by creating a user and setting your password.

Things to consider

A few things I did after I got n8n running, that you might want to do also.

1) Test your configuration and persistent storage, in case you update the container or have to reinstall it.

If it’s configured correctly, you could delete the container in Docker Desktop, re-create the container with the docker-compose.yml config and everything will run the same as before. To test this, it’s best to do it before you get deep into things.

I went through the initial user setup, then ran the below commands to delete the container and recreate it (make sure your terminal session is in the same folder as the install).

Bash
docker stop n8n
docker rm n8n
docker-compose up -d

If all went well, when you load n8n in the browser, you won’t see the initial setup screens. If you do see those setup screens though, review your configuration.

2) Setup hourly backups for your n8n workflows

If you have GitHub, then why not utilise one of the many n8n backup to GitHub templates. Look for one that handles changes, that way when you make a change, it updates it in GitHub too. I looked at several, and some were solely focused on just new files and a single upload.

3) Enable auto run on startup

It sounds obvious, but this auto run on boot is not default. Set Docker Desktop and your containers to run on startup.

Troubleshooting

If you encounter any issues during this process, it is important to troubleshoot common problems associated with Docker installations. First, check the Docker logs by using opening Docker Desktop, clicking on your container and selecting the logs tab, as shown below:

Reviewing the logs can help identify issues that need addressing. Additionally, ensure that Docker is running and that there are no firewall settings blocking access to the specified port (5678), although if you only run it using localhost, you shouldn’t need to worry about firewall rules.

If errors persist, verifying the Docker Compose file for accuracy and the correct installation of dependencies may also help resolve issues, and you can always copy the logs into ChatGPT, Claude, Gemini or another AI to get some help.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.