Docker Container Management API for WHMCS/WISECP - n8n Workflow

Use this powerful n8n workflow template to deploy, provision, manage, and monitor Docker containers remotely via an API integrated with WHMCS or WISECP, leveraging robust SSH scripting.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Hosting providers utilizing WHMCS or WISECP for billing.

  • DevOps teams needing a streamlined API for automated Docker container lifecycle management.

  • Engineers looking for a customizable n8n template to execute complex remote SSH commands.

  • Users who require a reliable n8n workflow to provision resources (like RAM, CPU, and disk space) dynamically.

Overview

This advanced n8n workflow provides a seamless automation layer, turning complex DevOps provisioning operations into simple, secure API calls. It solves the significant challenge of integrating enterprise billing systems (WHMCS/WISECP) directly with remote Docker infrastructure. By leveraging this sophisticated n8n workflow, you gain the ability to deploy, suspend, terminate, start, stop, and monitor individual Docker containers (often used for isolating user services like n8n instances themselves) on a host server. The automation handles intricate details such as disk image creation (fallocate), filesystem formatting (mkfs.ext4), fstab mounting, and NGINX configuration updates.

This reusable n8n template greatly simplifies infrastructure management, ensures transactional integrity via robust error handling in the executed shell scripts, and provides a crucial layer of backend automation for any modern hosting platform relying on Docker.

How it Works

The entire automation process starts with the API n8n trigger (a Webhook node) configured to accept secure POST requests containing the required commands and parameters (e.g., domain, disk size, RAM, CPU). This n8n trigger is protected by basic authentication.


  1. Validation & Parameterization: The n8n workflow first uses the Parametrs n8n node to define server-specific global variables. An If n8n node validates that the incoming request targets the correct server domain; otherwise, it returns a 422 error.

  2. Command Routing: Multiple Switch n8n nodes (Service Actions, Container Stats, Container Actions, n8n) route the request based on the command field (e.g., create, suspend, containerinformationstats).

  3. Dynamic Script Generation: For crucial actions like create or change_package, Set n8n nodes (Deploy-docker-compose, Deploy, Unsuspend) dynamically generate the precise Bash shell script needed, incorporating variables like CPU limits, memory constraints, and disk paths. These scripts handle file creation, permission setting, file system mounting, and running docker-compose up -d.

  4. Execution Core: The SSH n8n node takes the dynamically generated script ($json.sh) and executes it remotely on the configured Docker host server, using SSH credentials.

  5. Response Processing: The Code1 n8n node intercepts the raw stdout from the SSH command. This custom Code n8n node is vital for parsing success markers or detailed JSON data returned by the shell script, formatting it into a clean, standardized JSON response.

  6. Final Response: The API answer n8n node completes the n8n workflow by returning the status and data back to the originating billing system.

This detailed n8n workflow ensures high reliability and complete control over the remote Docker environment.

Installation Guide

To deploy this powerful n8n workflow template, follow these steps:


  1. Import: Import the provided JSON data into your n8n instance.

  2. Webhook Setup: The API n8n trigger requires Basic Authentication credentials (httpBasicAuth). Create these credentials and link them to the Webhook node.

  3. SSH Credentials: Create SSH Password credentials (sshPassword) that allow password or key-based access to your target Docker host server. Link these credentials to the SSH n8n node.

  4. Parameter Configuration: Update the Parametrs n8n node.

serverdomain: Set this to the domain name of the physical server running Docker.
clients
dir: Specify the directory on the host where client data (e.g., compose files) will be stored (e.g., /opt/docker/clients).
* mount_dir: Specify the base directory for disk mounting (e.g., /mnt).

  1. Activate: Activate the n8n workflow. The Webhook URL, accessible via the API n8n node, will now be live and ready to receive commands from WHMCS/WISECP.

Node Details

API (Webhook n8n trigger): Serves as the listener for API calls from WHMCS/WISECP, accepting POST methods on /docker-n8n and securing access via Basic Auth.
Parametrs (Set n8n node): Central storage for critical static configuration parameters used throughout the n8n workflow, such as directory paths and server identifiers.
If/Switch (Flow Control n8n nodes): Responsible for parsing the incoming API command and routing the execution path to the correct action block (e.g., Service Actions, Container Stats, or n8n specific commands).
Deploy-docker-compose (Set n8n node): Dynamically generates the complete docker-compose.yml file content, inserting variables for RAM, CPU limits, and container names based on the payload of the n8n trigger.
Deploy, Suspend, Terminated (Set n8n nodes): These are critical components of the n8n workflow, creating the complex multi-line Bash scripts used for provisioning and de-provisioning. The scripts handle tasks like mounting disk images, managing fstab entries, and controlling NGINX proxy configurations.
SSH (SSH n8n node): The primary action n8n node. It securely connects to the remote server and executes the shell script generated by the preceding Set n8n node, performing all necessary Docker and filesystem operations.
Code1 (Code n8n node): This node processes the standard output and error output from the remote SSH command, ensuring the billing system receives a formatted JSON response indicating success or error status, making this n8n workflow highly robust.
API answer (RespondToWebhook n8n node): The final n8n node in the flow, sending the resulting status back to the client application.

Related n8n Workflows

Free

Nodes: 8 Nodes
Updated: December 26 2025
View all
Created by

We are a Poland-based IT company specializing in secure, high-performance infrastructure and outsourcing solutions. Our TIER 3 data center ensures reliability, and we prioritize data privacy over commercial indexing. We offer corporate email, encrypted collaboration tools, private web hosting, VPN security, and IT management for companies with 10+ employees. Our open-source approach guarantees flexibility without vendor lock-in.

Featured*