← Back to Blog

Running n8n on Docker

Running n8n on Docker � How to Run n8n Using Docker 🐳 Running n8n (a powerful workflow automation tool) using Docker is simple and efficient. You have two main options: using a basic Docker command or setting up a more robust environment with Docker Compose .

Running n8n on Docker


� How to Run n8n Using Docker 🐳

Running n8n (a powerful workflow automation tool) using Docker is simple and efficient. You have two main options: using a basic Docker command or setting up a more robust environment with Docker Compose. Below, we’ll walk you through both methods step by step. πŸš€


πŸ‹ Option 1: Running n8n with Docker

1️⃣ Create a Docker Volume for Persistent Data πŸ“‚

To ensure your n8n workflows and credentials are saved even after restarting the container, create a Docker volume for persistent data.

docker volume create n8n_data

This command creates a volume named n8n_data to store your n8n data securely. πŸ”’


2️⃣ Run the n8n Docker Container πŸƒβ€β™‚οΈ

Use the following command to start the n8n container:

docker run -it --rm \
--name n8n \
-p 5678:5678 \
-v n8n_data:/home/node/.n8n \
docker.n8n.io/n8nio/n8n

  • -p 5678:5678: Maps port 5678 on your host machine to the container’s port 5678.

  • -v n8n_data:/home/node/.n8n: Mounts the n8n_data volume to the container’s data directory.

Once the container is running, you can access n8n by navigating to:
🌐 http://localhost:5678

For more details, check out the official documentation: n8n Docs. πŸ“š


🐳 Option 2: Running n8n with Docker Compose

For a more advanced setup, especially in production environments, Docker Compose is the way to go. It allows you to define and manage multi-container Docker applications with ease. πŸ› οΈ


1️⃣ Install Docker Compose ⬇️

Ensure Docker Compose is installed on your system. If not, follow the official Docker Compose installation guide. πŸ“₯


2️⃣ Create a Docker Compose File πŸ“„

Create a docker-compose.yml file with the following configuration:

version: '3.7'

services:
n8n:
image: docker.n8n.io/n8nio/n8n
ports:
- "5678:5678"
volumes:
- n8n_data:/home/node/.n8n

volumes:
n8n_data:

  • image: Specifies the n8n Docker image.

  • ports: Maps port 5678 on your host to the container.

  • volumes: Uses the n8n_data volume for persistent storage.


3️⃣ Start the n8n Service πŸš€

Run the following command in the directory where your docker-compose.yml file is located:

docker-compose up -d

This will start the n8n service in detached mode. You can access it at:
🌐 http://localhost:5678


πŸŽ‰ You’re All Set! πŸŽ‰

Whether you choose the simple Docker command or the more advanced Docker Compose setup, you now have n8n up and running! Enjoy automating your workflows with ease. πŸ€–βœ¨


Feel free to customize this content further to match your WordPress theme or audience preferences! πŸ–ŒοΈ


Imported from rifaterdemsahin.com Β· 2025