Personal tools
Namespaces

Variants
Actions

Portainer Docker Containers For WHMCS

From ModulesGarden Wiki
Revision as of 10:07, 27 May 2025 by Karolina (Talk | contribs)

Jump to: navigation, search

Contents

About Portainer Docker Containers For WHMCS

Portainer Docker Containers For WHMCS is a module that connects your WHMCS system with Portainer, allowing you to sell and manage Docker containers just like traditional hosting products.

It automates the deployment process, so containers are created, configured, and assigned to clients instantly upon purchase.
Clients can control their containers directly from the WHMCS client area, including start, stop, restart actions, viewing logs, accessing the console, and more.
You can also enable "App Templates" to let clients reinstall their stack using predefined configurations.

  • Addon Module Features:
✔ ffffff
✔ fffffffffff
✔ f
✔ Set Failure Count To Trigger Notification
  • Client Area:
✔ Create Monitoring Checks For Allowed Services Within Specified Limits:
✔ Set Server Monitoring Check Limit
  • General Info:
✔ Multi-Language Support With Custom Translations Tool
✔ Supports PHP 8.4 Back To PHP 8.1
✔ Supports WHMCS V8.13 Back To WHMCS V8.10
✔ Requires ionCube Loader V14 Or Later
✔ Easy Module Upgrade To Open Source Version

Installation And Confiuration

This tutorial will show you how to successfully install and configure Portainer Docker Containers For WHMCS.

We will guide you step by step through the whole installation and configuration process.

1. Log in to our client area and download the module.
PDC 1.png
2. Extract the package and upload its content into the main WHMCS directory.

The content of the package to upload should look like this.

PDC 2.png
3. When you install Portainer Docker Containers For WHMCS for the first time you have to rename 'license_RENAME.php' file.

The file is located in 'modules/servers/PortainerDockerContainers/license_RENAME.php'. Rename it from 'license_RENAME.php' to 'license.php'.

PDC 3.png
4. In order to configure your license key, you have to edit the previously renamed 'license.php' file.

Enter your license key between quotation marks as presented on the following screen. You can find your license key in our client area → 'My Products'.

PDC 4.png
5. Now, set up the 'storage' folder as recursively writable.

This folder is available at '/yourWHMCS/modules/addons/PortainerDockerContainers/'.
Note: It is needed for the Media Library to store uploaded images safely.

PDC 5.png

Addon Activation

6. Now you have to activate the module in your WHMCS system.

Log in to your WHMCS admin area. Go to 'System Settings' 'Addon Modules'. Afterwards, find 'Portainer Docker Containers' and press the 'Activate' button.

PDC 6.png
7. In the next step, you need to permit access to this module.

To do so, click on the 'Configure' button, tick 'Full Administrator' and press 'Save Changes'.

PDC 6 1.png
8. You have just successfully installed Portainer Docker Containers For WHMCS!

You can access your module under 'Addons' 'Portainer Docker Containers'.
Read the guide provided in the 'App Templates' or continue with this documentation.

PDC 6 2.png

Configuration of Server

9. Now, log in to your WHMCS and proceed to 'System Settings' 'Servers' and press 'Add New Server'.
PDC 7.png
10. Fill in the Name, provide the Hostname or IP Address in both fields at the top (filling in both Hostname and IP Address fields is required to proceed).

In the Server Details section:

  • Set Module to 'Portainer Docker Containers'
  • Access Key ID / Username - this field can be skipped.
  • Enter your Secret Access Key / Password - use an admin API key.
  • Click Test Connection to ensure proper communication with the Portainer instance.
  • Click the Configure button to select your desired environment (Portainer endpoint).
    Note: The environment defines all core settings, such as available resources (CPU, RAM, GPU) and what container or stack templates will be used.
    These are configured directly in Portainer. In the WHMCS module, you only choose from existing environments.
  • After selecting the environment, the Access Hash will be filled in automatically.
  • If your Portainer server uses SSL, ensure the Secure' checkbox is enabled.
    You can also enable the Override with Custom Port option and enter your custom Portainer API port.
  • Finally, adjust SSO Access Control if needed, then click Save Changes.
PDC 8.png
PDC 8 1.png
11. It is time to create a server group. To do so, click on 'Create Server Group'.
PDC 9.png
12. Enter a name, click on your previously created server, press 'Add' and afterward 'Save Changes'.
PDC 10.png

Configuration of Product

13. In order to create and configure a product, go to 'System Settings' 'Products/Services'.

Click on 'Create a New Group' .

PDC 11.png
14. Enter a product group name and press 'Save Changes'.
PDC 12.png
15. When you have a product group, you can create your product.

To create a product click on 'Create a New Product' .

PDC 13.png
16. Afterward, choose your product group, module and type from the dropdown menus, enter your product name and press 'Continue'.

'Product Type' should be set to 'Shared Hosting'.

PDC 14.png

App Templates

Before continuing to the product's settings, you must ensure you have at least one application or group of applications ready to use.
Proceed to the addon module → App Templates section and follow below instruction to create a ready application that will be installed by default on the server.

The App Templates section allows you to manage Docker-based applications that clients can deploy to their containers or stacks directly from the client area.
Templates are divided into two types, available under separate tabs: Container Applications and Stack Applications.
Use the interface to import, edit, group, and assign application templates to products.

Applications

This section allows you to load available templates from your connected Portainer environment and manage them within WHMCS.
  • Switch between available categories: Container Applications or Stack Applications using the tabs at the top.
  • Click the refresh icon to import or update the list of templates from Portainer.
PDC 22.png
Once templates are imported, you can use action buttons to edit, duplicate, or delete them. Mass actions are also available for bulk management.
PDC 23.png

Groups

With the templates ready, all that is left is to gather them into groups and include said groups into products.

Navigate to 'App Templates' 'Groups' and click on the 'Create' button.

PDC 26.png
Read the information, then provide the group with:
  • Name
  • Description
  • Items to include
PDC 27.png
You can use the action button and the mass action function to edit and delete template groups.
PDC 28.png
Your basic configuration of App Templates is now ready. For more advanced configuration, manual creation guides please refer to App Templates Advanced Configuration section in this documentation.

For now, go back to your product's module settings and complete the configuration there.

Module Settings

17. Now, go to the 'Module Settings' section, choose your previously created server group from the dropdown menu.

The module should automatically save and reload settings. If not, click on 'Save Changes' manually.

PDC 15.png
18. Proceed to 'Configuration' section and adjust the following:
  • Default Instance Name - Enter the default name to be used when creating a new stack or container. The name must contain only lowercase letters, digits, hyphens (-), or underscores (_).
    Available variables: {$domain}, {$client.id}, {$service.id}, {$order.id}, {$random}.
    If left empty, the domain name will be used.
  • Default Username - Enter the default username to be used when creating a new user.
    Available variables: {$domain}, {$client.id}, {$service.id}, {$order.id}, {$random}.
    If left empty, the domain name will be used.
  • Open Container Console in New Window - Enable this option to open the container console in a new window when the feature is available in the client area.
PDC 16.png
19. Proceed with 'App Template Configuration'.

App Templates Configuration - To create instances based on stack or container applications, you must first configure the App Templates in the module's addon.
Once your applications and groups are set up there, you can select the desired application in the product's Module Settings tab to be used during instance creation.
Please refer to the App Templates and App Templates Advanced Configuration sections of the documentation for detailed setup instructions.

  • Default Application Group - The group of applications available for reinstalls. See the Groups section for more details.
  • Default Application - The application that will be installed by default during container or stack creation. See the Applications section.
    Note that if applications are downloaded from the server, they will be divided into two categories: Container Applications and Stack Applications.
    Make sure to choose the default application based on the type of product you are configuring.
PDC 17.png
20. Set up 'Container Limits':
  • Memory Reservation [MB] - Specify the amount of memory (in MB) reserved for the container. Set to 0 for no reservation.
  • Memory Limit [MB] - Set the maximum amount of memory (in MB) the container can use. Use 0 for unlimited.
  • CPU Limit [Cores] - Set the maximum number of CPU cores available to the container. Use 0 for unlimited.

Alternatively, you can use configurable options to allow clients to define these limits at checkout.

PDC 18.png
21. Next, select the features that will be available in the client area:
  • Container Details - Show basic information about the container, such as status, IP address, and resource usage.
  • Stack Details - Display information related to the assigned stack configuration.
  • Start - Allow clients to start their container.
  • Stop - Allow clients to stop their container.
  • Restart - Allow clients to restart their container.
  • Reinstallation - Enable access to predefined application templates for quick reinstall.
  • Environment Variables - Allow clients to view or manage container environment variables.
  • Published Ports - Show mapped ports between the host and the container.
  • Container Logs - Provide access to real-time container logs.
  • Console - Allow access to the container's interactive console.
  • Graph - Show performance graphs such as CPU, memory, and network usage.
  • Assigned Containers - Display a list of all containers assigned to the client.
  • Action Logs - Provide a history of actions performed on the container (e.g. start, stop, reinstall).
PDC 19.png
22. Select the features that will be available in the admin area.

These options define what information and controls admins will see within the WHMCS service management page:

  • Service Actions - Perform start, stop, or restart actions directly from the admin area.
  • Stack Details - View the full configuration and status of the assigned stack.
  • Assigned Containers - Display all containers linked to the service.
  • Container Details - Show detailed information about the container, such as IP address, image, and resource usage.
  • Published Ports - View the port mappings for the container.
  • Environment Variables - View environment variables set for the container.
  • Container Logs - Access logs generated by the container.
  • Graphs - Display real-time resource usage graphs (CPU, RAM, network, disk I/O) per container.
  • Action Logs - Review all actions performed on the container or stack from within WHMCS.
PDC 20.png
23. At the end of the configuration process, you can decide whether to generate configurable options for the product.

Configurable options allow clients to customize container parameters individually during the order process. If no configurable options are defined, the fixed values set in the product configuration will be used instead.

Available Configurable Options:

  • appApplication
  • memory_reservationMemory Reservation
  • memory_limitMemory Limit
  • max_cpu_usageCPU Limit
PDC 21.png
PDC 21 0.png
Your product configuration is now complete. Do not forget to save the changes once ready.

Before adding it to your offer, make sure to set appropriate pricing. Create as many products as needed, each with different applications or feature sets, to tailor your offer perfectly.

PDC 21 1.png

Management

Portainer Docker Containers For WHMCS allows your clients to manage and monitor their Docker containers directly from the WHMCS client area.

In this short guide, you'll learn about the module's key features and how to configure them for both client and admin use.

Module Addon

The module addon is the central place for all administrative setup and management.

Here, you can register products supported by the module, manage Docker templates, and access various utilities such as the media library, translation manager, and module logs.

App Templates Advanced Configuration

Please see the App Templates for basic configuration, here you will find instructions for advanced users on how to manually manage existing container and stack application templates.

Admins can manually edit applications, define their runtime behavior, set default values, and customize input fields in the "Setting Details" section.

Traefik Labels in Container Applications

Portainer Docker Containers For WHMCS supports the Traefik reverse proxy to automatically expose deployed containers and stacks via domain-based routing.
This is achieved using dynamic Docker labels set in the application template (Container Applications) or docker-compose.yml files (Stack Applications).
To configure Traefik for a container-based application, go to the App Templates → Applications tab in the addon module, edit your container application, and navigate to the Setting Details section.
PDC 32.png
Add the following labels as individual settings. You can use Smarty variables like {$hosting.id} or {$hosting.domain} for dynamic route generation:
traefik.enable=1
traefik.docker.network=bridge
traefik.http.routers.service-{$hosting.id}.entrypoints=web
traefik.http.routers.service-{$hosting.id}.rule=Host(`{$hosting.domain}`)
traefik.http.routers.service-{$hosting.id}.service=service-{$hosting.id}
traefik.http.services.service-{$hosting.id}.loadbalancer.server.port=80

The application will be deployed with these labels automatically. The placeholder variables will be parsed at runtime, ensuring correct values for each service.

Important: Make sure that both the Traefik container and the newly created service are attached to the same Docker network (e.g., bridge) to ensure routing works as expected.

PDC 33.png

Traefik with Stack Applications

Stack-based applications can also be configured with Traefik by modifying the template_stack_file field in the App Template form.
PDC 34.png
You must supply a full and valid docker-compose.yml script with the required Traefik labels.

Below is an example that exposes a WordPress stack through Traefik:

version: '2'

services:
   db:
     image: mysql:5.7
     volumes:
       - db_data:/var/lib/mysql
     restart: always
     network_mode: bridge
     environment:
       {literal}MYSQL_ROOT_PASSWORD: strongpassword{/literal}
       MYSQL_DATABASE: wordpress
       MYSQL_USER: wordpress
       MYSQL_PASSWORD: wordpress
     ports:
       - "3306:3306"

   wordpress:
     image: wordpress:latest
     network_mode: bridge
     ports:
       - "8{$hosting.id}:80"
     restart: always
     environment:
       WORDPRESS_DB_HOST: 10.10.10.8:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: wordpress
     labels:
       traefik.enable: "true"
       traefik.docker.network: "bridge"
       traefik.http.routers.service-{$hosting.id}.entrypoints: "web"
       traefik.http.routers.service-{$hosting.id}.rule: "Host(`{$hosting.domain}`)"
       traefik.http.routers.service-{$hosting.id}.service: "service-{$hosting.id}"
       traefik.http.services.service-{$hosting.id}.loadbalancer.server.port: "80"

volumes:
    db_data:
PDC 35.png

Media Library

The media library allows you to upload images for use elsewhere in the module by admins and clients.

To upload a new picture, click on the 'Upload Image' button.
Note: The icons used in the Media Library by default are provided by Simple Icons and are licensed under the CC0 1.0 Universal (Public Domain Dedication) license.

PDC 37.png
You can delete images one by one by clicking on them.

To delete all images at once, use the additional action button.

PDC 38.png

Translations

Customizing language files is now extremely easy with the "Translations" tool that is now available directly in the addon.
Its user-friendly design makes managing various language file tweaks a smooth and efficient process.

Prepare translations for the original English files with this handy built-in tool. For specific instructions on how to use this tool please refer to its dedicated article, you will find it here.

PDC 39.png

Logs

The 'Logs' tab is where the module logs are stored.

You can filter the module logs by type with the 'Show' buttons:

  • Info
  • Notice
  • Error
  • Critical
  • Total

All information on Logs can be found in the dedicated Logs article.

PDC 40.png

Dashboard

The 'Dashboard' provides information and statistics related to the functions of the module.

Press "i" to see service details.

PDC 41.png

Ordering

Oredr page summary
PDC 45.png

Admin Area

Admin Area product page view.

Stack View

PDC 46.png
Container-based product type
PDC 46 0.png

Client Area

With Portainer Docker Containers For WHMCS, clients can fully manage their Docker containers and stacks directly from the WHMCS client area.

They can view service information, monitor performance, execute key actions, and deploy applications, all without needing direct access to Portainer.
Available features depend on the options enabled in the product configuration.

Service Actions: Clients can quickly start, stop, or restart their containers/stacks?? using dedicated control buttons.

Stack View

Below, you can see what the product might look like for the client "Stack" type with assigned Containers.

Table with Stack Details with any essential stack information, including name, current status, and exposed environment variables. Table with Assigned Containers that includes a list of all containers associated with the client’s stack.
Each entry includes the container name, status, image, IP address, and published ports.
Clicking a container entry opens a detailed view with technical and performance data.

PDC 47 0.png
"Assigned Container" to Stack view.

Clicking on a container from the stack view opens a dedicated detail panel with full technical insight.
The view is divided into multiple sections for clarity and easier access to specific information.
Use the same action buttons — Start, Stop, and Restart — directly within the container view for instant control.
Service Management - described in detils below,
Container details
published ports - – Mappings between private and public ports, including protocol types

Environment Variables
All environment variables currently assigned to the container are displayed, including sensitive configuration data and service paths.

PDC 48.png

Container View

Here is the "Container" product type view:

Incldes everthing taht is described above.

PDC 47.png

Action Logs

The Action Logs section tracks all actions performed on the container or stack, such as starting, stopping, reinstallation, and template deployments.

This history helps clients verify activity and troubleshoot potential issues.

PDC 51.png

Console

Web-based terminal access for direct container management. Opened directly in the WHMCS client area or in a seaprate tab.
PDC 52.png

Contaiener Logs

Live log output of the container’s stdout and stderr.
PDC 56.png

Graphs

Real-time resource graphs including CPU, memory, network, and I/O statistics
PDC 58.png

Reinstallation

The App Templates section allows clients to reinstall their container or stack using a predefined application template.
This provides a fast and simple way to deploy fully configured environments such as databases, web servers, or development tools.
Important: Reinstalling an application will permanently remove any existing container data.

PDC 53.png

Fill in required fields if thgere are any, in some cases ther might be more, in some none, jsut confirm the action if you are sure you wish to proceed.
Important: Reinstalling an application will permanently remove any existing container data.

PDC 54.png

Tips

1. If you

Update Instructions

An essential guidance through the process of updating the module is offered here.

Ensure successful completion of the module update by carefully following each step, thereby preventing data loss or any unforeseen issues.
Additionally, you will find a current list of supplementary actions necessary for a smooth update process there.

Upgrade Guide

Seeking a solution that offers greater flexibility, customization tailored to your precise needs, and unrestricted availability?
There is an option that not only proves to be cost-effective in the long run but also includes prioritized support services, making it a truly valuable investment.

Opt for the Open Source version of your Server Monitoring For WHMCS module to unlock these benefits.
Simply click on either the Get Source Code or Upgrade To Lifetime button found on the product's page in our client area to complete the one-step upgrade process, with a dedicated discount already applied.

Follow a comprehensive guide covering the transition process, the advantages it brings, and step-by-step instructions on what to do next after the order has been successfully finalized.

Common Problems

1. When you have problems with connection, check whether your SELinux or firewall does not block ports.
Navigation
WHMCS Modules
WHMCS Widgets
Tools And Applications
Translations
General
FAQ
Community
Portainer Docker Containers For WHMCS