Run n8n Locally for Free with Docker (Part 3 of 10): Your First n8n Container
By Abhishek Patoliya · 2026-08-12
This is Part 3 of the series on running n8n locally with Docker for free. With Docker installed from Part 2, this part covers the single command that actually gets n8n running, and what each part of that command is doing.
← Back to the full series index
The Command
docker run -it --rm \
--name n8n \
-p 5678:5678 \
n8nio/n8n
Run this in a terminal, and after a few seconds of startup logs, open http://localhost:5678 in a browser. You should see n8n's setup screen asking you to create an owner account — that's it, n8n is running.
What Each Flag Actually Does
docker run — creates and starts a new container from an image.
-it — runs it interactively and attaches your terminal to its output, so you see n8n's logs directly. Useful for this first run; later parts run it detached in the background.
--rm — automatically removes the container when it stops. Fine for this quick first test, but means anything you do inside n8n right now disappears when you stop it — don't create real workflows yet.
--name n8n — gives the container a memorable name so later commands (docker stop n8n, docker logs n8n) don't need a random generated ID.
-p 5678:5678 — maps port 5678 on your machine to port 5678 inside the container, which is where n8n listens by default.
n8nio/n8n — the official n8n image, pulled from Docker Hub automatically the first time you run this.
A Version You Can Actually Stop and Restart
For anything beyond a thirty-second test, drop --rm and -it so the container runs in the background and survives being stopped:
docker run -d \
--name n8n \
-p 5678:5678 \
n8nio/n8n
-d ("detached") runs it in the background instead of attaching your terminal to it. From here:
docker stop n8n — stops it without deleting it.
docker start n8n — starts the same container again, picking up where it left off.
docker logs -f n8n — tails the logs if something isn't working.
docker rm n8n — actually deletes the container (only do this once you understand Part 4's volume setup, or you'll lose everything in it).
The Catch This Version Still Has
Even without --rm, this setup stores all of n8n's data — workflows, credentials, execution history — inside the container's own filesystem. That data survives a stop/start, but not a docker rm, and it's not stored anywhere you could easily back up or inspect from outside the container. That's exactly the gap Part 4 closes.
Compared with the official docs: n8n's Docker installation page uses the same image and port, but its first command already mounts a named volume (-v n8n_data:/home/node/.n8n) and sets GENERIC_TIMEZONE and TZ so schedules run in your time zone. The docs now recommend Docker Compose for anything long-lived. This series adds the volume in Part 4, environment variables in Part 6 and Compose in Part 5; the bare command above is only for a first look. (Checked against the n8n docs on 8 November 2026.)
Next Up
Continue to Part 4: Persisting Your Workflows with Docker Volumes, which fixes this so your data survives even if the container itself is deleted and recreated.
Written by Abhishek Patoliya, Senior n8n Developer & Automation Architect, Surat, India. Verified n8n Creator.