0% found this document useful (0 votes)
272 views7 pages

Docker - n8n Docs

The document provides a comprehensive guide for installing and hosting n8n using Docker, highlighting the advantages of a clean environment and easier database setup. It outlines prerequisites, commands for starting n8n, and configurations for using PostgreSQL, along with instructions for updating and managing the application. Additionally, it emphasizes the need for technical knowledge for self-hosting and offers a warning against using the tunnel service in production environments.

Uploaded by

Ffg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
272 views7 pages

Docker - n8n Docs

The document provides a comprehensive guide for installing and hosting n8n using Docker, highlighting the advantages of a clean environment and easier database setup. It outlines prerequisites, commands for starting n8n, and configurations for using PostgreSQL, along with instructions for updating and managing the application. Additionally, it emphasizes the need for technical knowledge for self-hosting and offers a warning against using the tunnel service in production environments.

Uploaded by

Ffg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Docker | n8n Docs https://docs.n8n.io/hosting/installation/docker/#n8n-wi...

Hosting n8n Installation

Docker Installation

Docker o�ers the following advantages:

• Installs n8n in � clean environment.

• Easier setup for your preferred database.

• Can avoid issues due to di�erent operating systems, as Docker


provides � consistent system.

• Can avoid compatibility issues due to di�erences in operating


systems and tools.

• Makes migrating to new hosts or environments more


straightforward.

You can also use n8n in Docker with Docker Compose. You can �nd
Docker Compose con�gurations for various architectures in the n8n-
hosting repository.

Self-hosting knowledge prerequisites

Self-hosting n8n requires technical knowledge, including:

• Setting up and con�guring servers and containers

• Managing application resources and scaling

• Securing servers and applications

• Con�guring n8n

n8n recommends self-hosting for expert users. Mistakes can lead to dat� loss, security issues,
and downtime. If you aren't experienced at managing servers, n8n recommends n8n Cloud.

1 of 7 5/19/25, 01:52
Docker | n8n Docs https://docs.n8n.io/hosting/installation/docker/#n8n-wi...

Prerequisites
Before proceeding, install Docker Desktop.

Linux Users

Docker Desktop is available for Mac and Windows. Linux users must install Docker Engine and
Docker Compose individually for your distribution.

Latest and Next versions

n8n releases � new minor version most weeks. The latest version is for production use. next
is the most recent release. You should treat next as � beta: it may be unstable. To report
issues, use the forum.

Current latest : 1.92.2


Current next : 1.93.0

Starting n8n
From your terminal, run:

1 docker volume create n8n_data


2
3 docker run -it --rm --name n8n -p 5678:5678 -v
n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n

This command creates � volume to store persistent data, downloads


the required n8n image, and starts your container, exposed on port
5678 . To save your work between container restarts, it also mounts �
docker volume, n8n_data , to persist your dat� locally.

Once running, you can access n8n by opening: http://localhost:5678

Using with PostgreSQL

2 of 7 5/19/25, 01:52
Docker | n8n Docs https://docs.n8n.io/hosting/installation/docker/#n8n-wi...

By default, n8n uses SQLite to save credentials, past executions, and


workflows. n8n also supports PostgreSQL, con�gurable using
environment variables as detailed below.

When using PostgreSQL, it's still important to persist the dat� stored in
the /home/node/.n8n folder. This includes n8n user dat� and, even
more importantly, the encryption key for credentials. It's also the name
of the webhook when using the n8n tunnel.

If n8n can't �nd the /home/node/.n8n directory on startup, it


automatically creates one. In this case, all existing credentials that n8n
saved with � di�erent encryption key will no longer work.

Keep in mind

While persisting the /home/node/.n8n directory with PostgreSQL is the recommended best
practice, it's not explicitly required. You can provide the encryption key by passing the
N8N_ENCRYPTION_KEY environment variable when starting your Docker container.

To use n8n with PostgreSQL, execute the following commands,


replacing the placeholders (depicted within angled brackets, for
example <POSTGRES_USER> ) with your actual values:

1 docker volume create n8n_data


2
3 docker run -it --rm \
4 --name n8n \
5 -p 5678:5678 \
6 -e DB_TYPE=postgresdb \
7 -e DB_POSTGRESDB_DATABASE=<POSTGRES_DATABASE> \
8 -e DB_POSTGRESDB_HOST=<POSTGRES_HOST> \
9 -e DB_POSTGRESDB_PORT=<POSTGRES_PORT> \
10 -e DB_POSTGRESDB_USER=<POSTGRES_USER> \
11 -e DB_POSTGRESDB_SCHEMA=<POSTGRES_SCHEMA> \
12 -e DB_POSTGRESDB_PASSWORD=<POSTGRES_PASSWORD> \
13 -v n8n_data:/home/node/.n8n \
14 docker.n8n.io/n8nio/n8n

3 of 7 5/19/25, 01:52
Docker | n8n Docs https://docs.n8n.io/hosting/installation/docker/#n8n-wi...

You can �nd � complete docker-compose �le for PostgreSQL in the


n8n hosting repository.

Setting timezone
To de�ne the timezone n8n should use, you can set the
GENERIC_TIMEZONE environment variable. Schedule-oriented nodes,
like the Schedule Trigger node use this to determine the correct
timezone.

You can set the system timezone, which controls what some scripts
and commands like date return, using the TZ environment variable.

This example sets the same timezone for both variables:

1 docker volume create n8n_data


2
3 docker run -it --rm \
4 --name n8n \
5 -p 5678:5678 \
6 -e GENERIC_TIMEZONE="Europe/Berlin" \
7 -e TZ="Europe/Berlin" \
8 -v n8n_data:/home/node/.n8n \
9 docker.n8n.io/n8nio/n8n

Updating
To update n8n, in Docker Desktop, navigate to the Images tab and
select Pull from the context menu to download the latest n8n image:

4 of 7 5/19/25, 01:52
Docker | n8n Docs https://docs.n8n.io/hosting/installation/docker/#n8n-wi...

You can also use the command line to pull the latest, or � speci�c
version:

1 # Pull latest (stable) version


2 docker pull docker.n8n.io/n8nio/n8n
3
4 # Pull specific version
5 docker pull docker.n8n.io/n8nio/n8n:1.81.0
6
7 # Pull next (unstable) version
8 docker pull docker.n8n.io/n8nio/n8n:next

After pulling the updated image, stop your n8n container and start it
again. You can also use the command line. Replace <container_id>
in the commands below with the container ID you �nd in the �rst
command:

1 # Find your container ID


2 docker ps -a
3
4 # Stop the container with the `<container_id>`
5 docker stop <container_id>
6

5 of 7 5/19/25, 01:52
Docker | n8n Docs https://docs.n8n.io/hosting/installation/docker/#n8n-wi...

7 # Remove the container with the `<container_id>`


8 docker rm <container_id>
9
10 # Start the container
11 docker run --name=<container_name> [options] -d
docker.n8n.io/n8nio/n8n

Updating Docker Compose

If you run n8n using � Docker Compose �le, follow these steps to
update n8n:

1 # Pull latest version


2 docker compose pull
3
4 # Stop and remove older version
5 docker compose down
6
7 # Start the container
8 docker compose up -d

Further reading
You can �nd more information about Docker setup in the README �le
for the Docker image.

n8n with tunnel


Danger

Use this for local development and testing. It isn't safe to use it in production.

To use webhooks for trigger nodes of external services like GitHub,


n8n has to be reachable from the web. n8n runs � tunnel service that

6 of 7 5/19/25, 01:52
Docker | n8n Docs https://docs.n8n.io/hosting/installation/docker/#n8n-wi...

can redirect requests from n8n's servers to your local n8n instance.

Start n8n with --tunnel by running:

1 docker volume create n8n_data


2
3 docker run -it --rm \
4 --name n8n \
5 -p 5678:5678 \
6 -v n8n_data:/home/node/.n8n \
7 docker.n8n.io/n8nio/n8n \
8 start --tunnel

Next steps
• Learn more about con�guring and scaling n8n.

• Or explore using n8n: try the Quickstarts.

7 of 7 5/19/25, 01:52

You might also like