Docker is a quick and simple way to download and start automating with n8n. By using Docker you are able to:
- Install to a pristine environment
- Easily install and run your preferred database with n8n
- Enjoy a quick and simplified installation experience regardless of your OS
Before proceeding ensure that you have installed Docker Desktop.
From your terminal, run:
1 2 3 4 5
This command will download all required n8n images and start your container, exposed on port
5678. So that all your data is not lost when you stop the container, it also mounts a local directory,
.n8n, to persist your data locally.
You can then access n8n by opening: http://localhost:5678
Using alternate databases#
By default n8n uses SQLite to save credentials, past executions and workflows. n8n also supports PostgresDB, MySQL and MariaDB, configurable via environment variables as detailed below.
It is important to still persist data in the
/root/.n8n folder as it contains n8n user data and even more importantly the encryption key
for credentials. It is also the name of the webhook when the n8n tunnel is used.
If no directory is found, n8n creates automatically one on startup. In this case, existing credentials saved with a different encryption key can not be used anymore.
Keep in mind
/root/.n8n directory even when using alternate databases is the recommended best practice, but not explicitly required. The encryption key can be provided via the
N8N_ENCRYPTION_KEY environment variable.
To use n8n with Postgres, provide the corresponding configuration:
1 2 3 4 5 6 7 8 9 10 11 12 13
docker-compose file for Postgres can be found here.
To use n8n with MySQL, provide the corresponding configuration:
1 2 3 4 5 6 7 8 9 10 11 12
To define the timezone n8n should use, the environment variable
GENERIC_TIMEZONE can be set. This gets used by schedule based nodes such as the Cron node.
The timezone of the system can also be set separately. This controls what
some scripts and commands return like
$ date. The system timezone can be set via the environment variable
Example using the same timezone for both:
1 2 3 4 5 6
More information about Docker setup can be found in the README file of the Docker Image.
n8n with tunnel#
This is only meant for local development and testing. Do not use it in production.
To be able to use webhooks for trigger nodes of external services like GitHub, n8n has to be reachable from the web. To make that easy, n8n has a special tunnel service which redirects requests from our servers to your local n8n instance.
Start n8n with
--tunnel by running:
1 2 3 4 5 6