/n8n-tutorials

How to install n8n on Docker?

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

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free consultation

How to install n8n on Docker?

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.

 

Recommended Simple Installation (Production‑safe basics)

 

// 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.

  • -p 5678:5678 exposes the n8n UI to your machine.
  • -v ~/.n8n:/home/node/.n8n mounts a persistent directory for the internal n8n storage.
  • n8nio/n8n is the official Docker image maintained by the n8n team.

 

Detailed Practical Explanation

 

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.

  • docker run -it --rm keeps the container interactive and removes it when stopped. For production you’d remove --rm so logs persist.
  • The 5678 port is the default n8n web interface port. In a browser you go to http://localhost:5678/.
  • The folder ~/.n8n on your host machine will contain JSON files that n8n uses internally. You normally don’t edit them manually, but it’s important they persist.

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.

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022