docker-api

Interact with Docker via direct API (no Portainer required) β€” manage containers, stream logs, and automate infrastructure workflows

Package Information

Released: 6 mo ago
Downloads: 8 weeklyΒ /Β 48 monthly
Latest Version: 0.1.6
Author: Ramy Gamal

Documentation

n8n Docker Node

🐳 n8n-nodes-docker-api

npm
License: MIT

Interact with Docker via direct API (no Portainer required) β€” manage containers, stream logs, and automate infrastructure with ease.


✨ Why this node?

Managing Docker via raw HTTP calls in n8n is painful and error-prone.

This node gives you:

  • πŸ” Clean container listing (normalized output)
  • πŸ“œ Readable logs (stdout/stderr separated, no binary noise)
  • ⚑ Simple control (start/stop containers safely)
  • πŸ” Built-in access control (read-only vs full control)

πŸ‘‰ Turn Docker into a first-class automation tool inside n8n


πŸš€ Quick Start

  1. Install the node:
npm install n8n-nodes-docker-api
  1. Add Docker API credentials
  2. Add the Docker node to your workflow
  3. Choose an operation and execute

βœ… No manual API calls needed


πŸ“¦ Installation

Community Nodes (Recommended)

  1. Go to Settings β†’ Community Nodes
  2. Install: n8n-nodes-docker-api

Manual Installation

npm install n8n-nodes-docker-api

πŸ§ͺ Usage

Docker Node in n8n

Docker Node UI

  1. Add the Docker node

  2. Select an operation:

    • List Containers
    • Get Container Logs
    • Start Container
    • Stop Container
  3. Configure credentials

  4. Execute the node


Example: List Containers

  • Operation: List Containers

  • Optional filters:

    • Name
    • Status
    • Show all containers

πŸ” Credentials

Credentials UI in n8n

Docker Credentials UI


Connection Modes

🟒 Unix Socket (Local)

  • Default for local Docker setups
  • Path: /var/run/docker.sock

🌐 TCP (Remote)

  • Connect to remote Docker daemon

  • Example:

    • Host: 192.168.1.10
    • Port: 2375

⚠️ Requires Docker daemon configured with:

-H tcp://0.0.0.0:2375

πŸ”’ TLS (Coming in v2)

  • Secure remote connection using certificates

Access Modes

🟑 Read Only (Recommended)

  • βœ… List containers
  • βœ… Get logs
  • ❌ Cannot start/stop containers

πŸ”΄ Full Control

  • βœ… All operations enabled

πŸ“‹ Supported Operations (v1)

Operation Description Access
List Containers Get containers with normalized output Read Only
Get Container Logs Logs with stream filtering & timestamps Read Only
Start Container Start stopped containers Full Control
Stop Container Stop running containers (with dry run) Full Control

πŸ”₯ Real Use Cases

♻️ Self-Healing Containers

Automatically restart crashed services:

List Containers β†’ IF (status != running) β†’ Start Container

🚨 Log-Based Alerting

Detect errors and notify:

Get Logs β†’ Search "ERROR" β†’ Send Slack alert

πŸ“Š Container Monitoring

Track system health:

Schedule β†’ List Containers β†’ Aggregate β†’ Report

🧠 Output Examples

List Containers

{
  "id": "3025272c7592...",
  "shortId": "3025272c7592",
  "name": "qdrant",
  "image": "qdrant/qdrant",
  "status": "running",
  "createdAt": "2026-03-13T23:19:38.000Z"
}

Logs

{
  "message": "Server started",
  "stream": "stdout"
}

πŸ”’ Security

⚠️ Docker access = host-level control

Best Practices

  • Use Read Only mode unless needed

  • Avoid exposing Docker over public TCP

  • Use a proxy like:

    • tecnativa/docker-socket-proxy
  • Restrict network access


πŸ§ͺ Testing

npm test

πŸ—ΊοΈ Roadmap

v2

  • Restart Container
  • Remove Container
  • Image operations (list/pull/remove)
  • TLS support
  • Container autocomplete

v3

  • Run container (ephemeral jobs)
  • Execute commands in container
  • Container stats

v4

  • Docker Trigger node (events)

⭐ Contributing

PRs and ideas are welcome β€” especially for new operations and improvements.


πŸ“„ License

MIT


πŸ’¬ Support

Open an issue on GitHub for:

  • Bugs
  • Feature requests
  • Questions

Discussion