Docker icon

Docker

Interact with Docker via Portainer API

Overview

This node allows users to create a Docker network by interacting with the Portainer API. It is designed for scenarios where you want to programmatically manage Docker networks within your infrastructure, such as automating network setup for containerized applications or integrating Docker network management into larger workflows.

A practical example would be creating isolated networks for different microservices environments or dynamically setting up networks during CI/CD pipelines to ensure containers communicate securely and efficiently.

Properties

Name Meaning
EndpointID Name or ID The identifier of the Docker endpoint to use for the operation. You can select from a list of available endpoints or specify an ID via expression.
Network Config The JSON string representing the network configuration to create. This should follow Docker's network configuration schema.

Output

The node outputs JSON data representing the response from the Portainer API after attempting to create the Docker network. This typically includes details about the newly created network such as its ID, name, driver type, and other metadata returned by the API.

No binary data output is produced by this node.

Dependencies

  • Requires access to a Portainer API instance.
  • Needs an API key credential configured in n8n to authenticate requests to the Portainer API.
  • The node uses the selected Docker endpoint ID to target the correct Docker environment via Portainer.

Troubleshooting

  • Common issues:

    • Invalid or missing endpoint ID: Ensure that the endpoint ID is correctly selected or specified.
    • Malformed network configuration JSON: Verify that the network configuration string is valid JSON and conforms to Docker's expected schema.
    • Authentication errors: Confirm that the API key credential is valid and has sufficient permissions.
    • Network creation failures due to Docker daemon issues or Portainer API limitations.
  • Error messages:

    • "Unauthorized" or "Authentication failed": Check API credentials.
    • "Invalid network configuration": Validate the JSON structure of the network config.
    • "Endpoint not found": Verify the endpoint ID exists and is accessible.

Links and References

Discussion