Portainer icon

Portainer

Work with Portainer API data to manage Docker

Service → Update

AI-generated

Overview

This node operation updates an existing Docker Swarm service in a specified environment using the Portainer API. It allows users to modify the service's Docker image and environment variables, ensuring the service runs with the desired configuration. This is useful for scenarios such as deploying new versions of an application, changing service settings, or updating environment variables without recreating the service.

Use Case Examples

  1. Updating a Docker Swarm service to use a new Docker image version.
  2. Modifying environment variables of a running service to change its behavior.

Properties

Name Meaning
Environment ID The ID of the environment/endpoint in Portainer where the service is located.
Service ID The ID of the Docker Swarm service to update.
Image The Docker image to use for the service update.
Environment Variables A collection of environment variables to set for the service's container specification during the update.
Version The object version number required for the update operation to ensure concurrency control.

Output

JSON

  • body - The response body from the Portainer API after updating the service, typically containing status or updated service details.

Dependencies

  • Portainer API with an API key credential for authentication

Troubleshooting

  • Ensure the Environment ID and Service ID are correct and correspond to existing resources in Portainer.
  • Verify that the Version number matches the current version of the service to avoid update conflicts.
  • Check that the Docker image name is valid and accessible from the environment's Docker registry.
  • If environment variables are provided, ensure they are correctly formatted as name-value pairs.
  • Network or authentication issues with the Portainer API can cause request failures; verify API credentials and network connectivity.

Links

Discussion