HiBlog Linux and Windows Server
How to Run n8n Locally with Docker or npm
- Ali GhanimatiAuthor
- Last updated
- 2 minutesReading time
- 441Views
- Ali Ghanimati
- Last updated:
- 2 min read
- 441 views
n8n turns a repeated sequence of actions into a workflow. A trigger starts it, and connected nodes read, transform, or send data. Running it locally lets you observe each node and practice with sample data before connecting an external service.
This guide uses port 5678 and limits access to your own computer. Make sure the port is free. Docker gives you a separate container and persistent volume. For npm, check the supported Node.js version in the n8n npm installation guide.
Run n8n with Docker
Start Docker and run the following. The named volume keeps n8n data when the temporary container exits.
docker volume create n8n_data
docker run --rm -it --name n8n-local -p 127.0.0.1:5678:5678 -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8nOpen http://localhost:5678 and complete the initial account setup. Use Ctrl+C to stop it, and use the same volume next time. This is a local practice setup. For longer-running deployments, see n8n’s Docker Compose instructions.
Run n8n with npm
Stop any other instance using the same port. On Linux or macOS:
N8N_LISTEN_ADDRESS=127.0.0.1 npx n8nOn Windows PowerShell:
$env:N8N_LISTEN_ADDRESS = '127.0.0.1'
npx n8nBuild a first workflow
Open http://localhost:5678 and start a new workflow with Manual Trigger. Add Edit Fields (Set) and set a string field called message to a sample value. Execute the workflow and inspect the second node’s output. Save it. External webhooks require a reachable address. A localhost URL is accessible only on that computer. How Docker and containers work.


