Docker icon

Docker

Interact with Docker via Portainer API

Actions107

Overview

This node allows users to interact with Docker through the Portainer API, specifically focusing on managing Docker networks. The "Network Delete" operation enables deleting a specified Docker network by its ID or name within a selected Portainer endpoint. This is useful for automating cleanup tasks, managing network resources programmatically, or integrating Docker network management into broader workflows.

Practical examples include:

  • Automatically removing unused or temporary Docker networks after a deployment pipeline finishes.
  • Cleaning up networks in multiple Docker environments managed via Portainer.
  • Integrating network deletion as part of container lifecycle automation.

Properties

Name Meaning
EndpointID Name or ID Selects the Portainer endpoint where the Docker network exists. You can choose from a list of available endpoints or specify an ID via expression.
Id The ID or name of the Docker network to delete. This identifies which network resource will be removed.

Output

The node outputs JSON data representing the response from the Portainer API after attempting to delete the specified Docker network. Typically, this will confirm success or provide error details if the deletion failed.

No binary data output is involved.

Dependencies

  • Requires access to a Portainer instance with the API enabled.
  • Needs an API authentication token credential configured in n8n to authorize requests to the Portainer API.
  • The node uses the Portainer API endpoint /api/endpoints/{endpointId}/docker to perform Docker operations scoped to the selected endpoint.

Troubleshooting

  • Common issues:

    • Invalid or missing endpointId: Ensure the endpoint is correctly selected and accessible.
    • Incorrect network id: Verify the network ID or name exists on the selected endpoint.
    • Authentication errors: Confirm that the API key or token credential is valid and has sufficient permissions.
    • Network connectivity problems between n8n and the Portainer server.
  • Error messages:

    • HTTP 404 Not Found: The specified network ID does not exist on the chosen endpoint.
    • HTTP 401 Unauthorized or 403 Forbidden: Authentication failure or insufficient permissions.
    • Timeout or connection refused: Network or server availability issues.

Resolving these typically involves verifying credentials, endpoint selection, and network existence before retrying.

Links and References

Discussion