Actions88
- Container Actions
- Container List
- Container Create
- Container Inspect
- Container Top
- Container Logs
- Container Changes
- Container Export
- Container Stats
- Container Resize
- Container Start
- Container Stop
- Container Restart
- Container Kill
- Container Update
- Container Rename
- Container Pause
- Container Unpause
- Container Attach
- Container Attach Websocket
- Container Wait
- Container Delete
- Container Archive Info
- Container Archive
- Put Container Archive
- Container Prune
- Image Actions
- Network Actions
- Volume Actions
- Swarm Actions
- Node Actions
- Secret Actions
- System Actions
- Exec Actions
- Service Actions
- Task Actions
Overview
This node interacts with Docker through the Portainer API, specifically focusing on network management. The "Network Prune" operation allows users to remove unused Docker networks based on specified filters. This is useful for cleaning up dangling or obsolete networks to free resources and maintain a tidy Docker environment.
Practical examples include:
- Automatically pruning networks older than a certain timestamp.
- Removing networks that match or do not match specific labels.
- Scheduled cleanup tasks in CI/CD pipelines or server maintenance workflows.
Properties
| Name | Meaning |
|---|---|
| EndpointID Name or ID | Selects the Docker endpoint to target via Portainer API. You can choose from a list of available endpoints or specify an ID using an expression. |
| Additional Fields | Optional collection of extra parameters. |
| └─ Filters | JSON-encoded filters to refine which networks to prune. Supported filters include: - until=<timestamp>: prune networks created before this time (supports Unix timestamps, date strings, or Go duration strings).- label filters: prune networks with or without specific labels, e.g., label=key, label=key=value, label!=key, or label!=key=value. |
Output
The node outputs JSON data representing the result of the prune operation. This typically includes information about which networks were removed and any relevant metadata returned by the Portainer API. There is no binary output.
Dependencies
- Requires access to a Portainer instance with Docker endpoints configured.
- Needs an API key credential for authenticating requests to the Portainer API.
- The node uses the Portainer API endpoint
/api/endpoints/{endpointId}/docker/network/pruneunder the hood. - Proper configuration of the endpoint ID is necessary to target the correct Docker environment.
Troubleshooting
Common issues:
- Invalid or missing endpoint ID: Ensure the selected endpoint exists and is accessible.
- Incorrect filter syntax: Filters must be valid JSON strings and follow the documented format.
- Authentication failures: Verify that the API key credential is valid and has sufficient permissions.
- Network connectivity problems between n8n and the Portainer server.
Error messages:
- Unauthorized or 401 errors indicate authentication issues; check API credentials.
- 404 errors may mean the endpoint ID does not exist or the URL is incorrect.
- Malformed filter errors suggest invalid JSON or unsupported filter keys/values.
Resolving these usually involves verifying credentials, endpoint configurations, and filter formats.
Links and References
- Portainer API Examples
- n8n Expressions Documentation
- Docker Network Prune API Reference (for understanding underlying Docker API behavior)