Portainer icon

Portainer

Trabalhe com dados da API do Portainer para gerenciar Docker

Overview

This node integrates with the Portainer API to manage Docker networks within specified environments (endpoints). Specifically, the Network - Delete operation allows users to delete a Docker network by its ID from a given environment. This is useful for cleaning up unused or obsolete networks in Docker environments managed via Portainer.

Typical use cases include:

  • Automating cleanup of Docker networks after container or service removal.
  • Managing network resources programmatically in CI/CD pipelines.
  • Integrating network management into broader infrastructure automation workflows.

Example: Automatically deleting a specific Docker network identified by its network ID from a particular Portainer environment to free up resources.

Properties

Name Meaning
Environment ID The ID of the Portainer environment/endpoint where the Docker network exists.
Network ID The unique identifier of the Docker network to be deleted.
Force Delete Boolean flag indicating whether to force deletion even if the network is currently in use.

Output

The node outputs the JSON response returned by the Portainer API after attempting to delete the specified network. Typically, this will be an empty object or confirmation message indicating successful deletion. If the deletion fails, the output will contain error details from the API.

No binary data is produced by this operation.

Dependencies

  • Requires a valid Portainer API key credential configured in n8n.
  • The node makes HTTP requests to the Portainer API endpoint URL provided in the credentials.
  • The user must have appropriate permissions in Portainer to delete networks in the specified environment.

Troubleshooting

  • Common issues:

    • Invalid or missing Environment ID or Network ID parameters.
    • Insufficient permissions to delete the network in Portainer.
    • Network is currently in use and cannot be deleted unless "Force Delete" is enabled.
    • Incorrect or expired API key credential.
  • Error messages:

    • 404 Not Found: The specified network or environment does not exist. Verify IDs.
    • 403 Forbidden: Permission denied. Check API key permissions.
    • 409 Conflict: Network is in use and cannot be deleted without forcing. Enable "Force Delete" if appropriate.
    • 401 Unauthorized: Authentication failed. Verify API key validity.

To resolve errors, ensure all IDs are correct, the API key has sufficient rights, and consider enabling "Force Delete" if the network is locked by active containers or services.

Links and References

Discussion