Portainer icon

Portainer

Trabalhe com dados da API do Portainer para gerenciar Docker

Overview

The node integrates with the Portainer API to manage Docker Swarm services. Specifically, the Service - Update operation allows users to update an existing Docker Swarm service's configuration, such as changing the Docker image or environment variables used by the service.

This is useful in scenarios where you want to deploy a new version of a service, modify its runtime environment, or adjust its container image without recreating the service from scratch. For example, updating a web application service to use a newer Docker image tag or injecting new environment variables for configuration.

Properties

Name Meaning
Environment ID The ID of the Portainer environment/endpoint where the Docker service is running.
Service ID The unique identifier of the Docker Swarm service to update.
Image The Docker image (including tag) to be used by the service after the update (e.g., nginx:latest).
Environment Variables A collection of environment variables to set on the service's containers. Each variable has a name and value.
Version The current version number of the service object, required for concurrency control during update.

Output

The node outputs JSON data representing the response from the Portainer API after attempting to update the service. This typically includes details about the updated service or confirmation of the update action.

No binary data output is involved in this operation.

Dependencies

  • Requires connection to a Portainer instance via its REST API.
  • Needs an API key credential configured in n8n to authenticate requests to Portainer.
  • The base URL of the Portainer API must be set in the credentials.
  • The node uses HTTP POST requests to the Portainer API endpoint corresponding to the service update.

Troubleshooting

  • Version Mismatch Error: If the provided version parameter does not match the current version of the service in Portainer, the update will fail. Ensure you fetch the latest service version before updating.
  • Invalid Service ID: Providing an incorrect or non-existent serviceId will result in a "not found" error. Verify the service ID is correct.
  • Authentication Errors: Missing or invalid API key credentials will cause authentication failures. Confirm that the API key is valid and properly configured.
  • Invalid Image Name: Using an improperly formatted or unavailable Docker image name may cause deployment issues. Validate the image name and tag.
  • Malformed Environment Variables: Environment variables should be provided as name-value pairs. Incorrect formatting can lead to errors.

Links and References


This summary focuses on the Service - Update operation of the Portainer node, describing how it updates Docker Swarm services through the Portainer API using specified parameters.

Discussion