วิธีติดตั้ง n8n และ Docker [สำหรับใช้งานจริง]

3 min read 3 days ago
Published on Aug 31, 2025 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

This tutorial provides a step-by-step guide on how to install n8n using Docker. n8n is an open-source workflow automation tool that allows you to connect various services and create complex workflows. By using Docker, you can easily deploy n8n in a containerized environment. This guide is designed for practical use and will help you set up n8n for real-world applications.

Step 1: Install Docker and Docker Compose

Before you can run n8n, you need to have Docker and Docker Compose installed on your machine.

  1. Install Docker

    • Visit the Docker installation page and follow the instructions specific to your operating system (Windows, macOS, Linux).
  2. Install Docker Compose

Step 2: Create a Docker Compose File

Now, you need to create a Docker Compose file that defines the n8n service and its configuration.

  1. Open your terminal or command prompt.

  2. Create a new directory for your project:

    mkdir n8n-docker
    cd n8n-docker
    
  3. Create a file named docker-compose.yml:

    touch docker-compose.yml
    
  4. Open the file in a text editor and add the following configuration:

    version: '3.8'
    services:
      n8n:
        image: docker.n8n.io/n8nio/n8n
        container_name: n8n
        restart: always
        ports:
          - "5678:5678"
        volumes:
          - n8n_data:/home/node/.n8n
        environment:
          - N8N_BASIC_AUTH_ACTIVE=true
          - N8N_BASIC_AUTH_USER=admin
          - N8N_BASIC_AUTH_PASSWORD=your_password
          - TZ=Asia/Bangkok
    volumes:
      n8n_data:
    
    • Replace your_password with a strong password of your choice.

Step 3: Start n8n with Docker Compose

With your docker-compose.yml file configured, you're ready to start n8n.

  1. In your terminal, run the following command:

    docker-compose up -d
    
    • This command starts the n8n service in detached mode.
  2. Check if n8n is running:

    • You can verify that n8n is running by checking the logs:
    docker-compose logs -f
    

Step 4: Access the n8n Interface

After starting n8n, you can access its web interface.

  1. Open your web browser and go to:

    http://localhost:5678
    
  2. Log in using the credentials you set in the docker-compose.yml file:

    • Username: admin
    • Password: your_password

Conclusion

You have successfully installed n8n using Docker and can now start building workflows. Remember to keep your Docker containers updated and manage your volumes for data persistence. As a next step, explore n8n’s features and consider integrating it with other services to automate your tasks effectively.