Learn how to install n8n on Docker step‑by‑step and set up automated workflows quickly with this simple, reliable setup guide.

Book a call with an Expert
Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.
To install n8n on Docker, you run the official n8nio/n8n container and map a local folder into the container so your workflows, credentials, and executions persist. A reliable production‑oriented command looks like running docker run with environment variables and a mounted volume (for example: ~/.n8n). That’s the simplest correct way to get n8n running on Docker.
// Create a local folder for n8n data persistence
mkdir ~/.n8n
// Start n8n using the official image
docker run -it --rm \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
n8nio/n8n
This starts n8n on port 5678 and ensures all your workflows, credentials, and logs survive container restarts.
When installing n8n in Docker, you’re basically telling Docker to run the n8n application inside an isolated environment. n8n stores important data (your workflows, credentials, execution metadata, etc.) inside a folder in the container called /home/node/.n8n. If you don’t mount this folder to your host computer, every time the container is recreated you’ll lose everything. That’s why mounting a volume is essential even for local testing, and absolutely mandatory for production.
The command above uses docker run which is the simplest method. In real production, teams often switch to docker-compose for easier management, environment variables, and automatic restarts, but the run command is the foundation and is fully valid.
If you want to set environment variables (for example enabling webhooks, setting timezone, enabling queue mode), Docker uses -e flags. This is the real method used in production.
// Example with common env vars
docker run -it \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
-e GENERIC_TIMEZONE="Europe/Berlin" \
-e N8N_BASIC_AUTH_ACTIVE=true \
-e N8N_BASIC_AUTH_USER="admin" \
-e N8N_BASIC_AUTH_PASSWORD="strongpassword" \
n8nio/n8n
Those environment variables are real ones supported by n8n, and they help secure your instance when you're running it outside your private network.
Once the container is running, n8n is immediately accessible in your browser. You don’t need to build anything or install dependencies — Docker isolates everything for you. This is the normal, stable, production‑safe way people run n8n in companies.
When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.