Run n8n Locally for Free with Docker (Part 4 of 10): Persisting Your Workflows with Docker Volumes
By Abhishek Patoliya · 2026-08-12
This is Part 4 of the series on running n8n locally with Docker for free. The container from Part 3 works, but delete it and every workflow, credential, and execution record goes with it. This part fixes that with a Docker volume — the piece that makes a local n8n setup actually trustworthy to build real workflows in.
← Back to the full series index
Where n8n Actually Stores Its Data
Inside the container, n8n keeps everything — its SQLite database, encryption key, and configuration — in /home/node/.n8n. Right now, that directory lives entirely inside the container's own filesystem. Mounting a volume there means Docker manages that data outside the container, so removing and recreating the container doesn't touch it.
The Updated Command
docker volume create n8n_data
docker run -d \
--name n8n \
-p 5678:5678 \
-v n8n_data:/home/node/.n8n \
n8nio/n8n
The first command creates a named volume once. The -v n8n_data:/home/node/.n8n flag mounts it into the container at exactly the path n8n stores its data — everything n8n writes there now lives in the volume, not the container.
Proving It Works
- Open
http://localhost:5678, complete the owner account setup, and create a simple test workflow.
- Remove the container entirely:
docker rm -f n8n. Notice this doesn't touch the volume — only the container.
- Start a fresh container with the exact same volume mount:
docker run -d \
--name n8n \
-p 5678:5678 \
-v n8n_data:/home/node/.n8n \
n8nio/n8n
- Open
http://localhost:5678 again — your test workflow and account should still be there, because the volume, not the container, was holding the actual data all along.
Named Volume vs. Bind Mount
The named volume above (n8n_data) is the simplest option and is what this series uses going forward — Docker manages where it physically lives on disk. The alternative is a bind mount to a specific folder you choose:
-v ~/n8n-local-data:/home/node/.n8n
This is useful if you specifically want to browse the underlying SQLite file or back up that folder with a regular file-sync tool. Functionally, both approaches persist the same data — pick based on whether you want Docker to manage the storage location or you do.
Recovering Data From a Volume-less Container
If you followed Part 3 without a volume and still have that container (check with docker ps -a — if it hasn't been removed, it's still there even if stopped), you can copy its data out before switching:
docker cp n8n:/home/node/.n8n ./recovered-n8n-data
Then move the recovered files into your new volume, or just start fresh if the test data wasn't worth keeping.
Next Up
The docker run command is getting long. Part 5: A Cleaner Setup with Docker Compose moves all of this into a single, readable configuration file.
Written by Abhishek Patoliya, Senior n8n Developer & Automation Architect, Surat, India. Verified n8n Creator.