Portainer icon

Portainer

Work with Portainer API data to manage Docker

Service → Delete

AI-generated

Overview

This node operation deletes a Docker Swarm service in a specified environment using the Portainer API. It is useful for managing and cleaning up services in Docker Swarm clusters, especially when automating infrastructure management or integrating service lifecycle management into workflows.

Use Case Examples

  1. Deleting a specific Docker Swarm service by its ID in a given environment to free up resources or remove outdated services.
  2. Automating the removal of services as part of a CI/CD pipeline or infrastructure cleanup process.

Properties

Name Meaning
Environment ID The ID of the environment/endpoint in Portainer where the service is running. This identifies the target Docker environment for the deletion operation.
Service ID The ID of the Docker Swarm service to be deleted. This uniquely identifies the service within the environment.
Force Delete A boolean flag indicating whether to force the deletion of the service even if it is currently in use or has dependencies. Defaults to false.

Output

JSON

  • response - The response from the Portainer API after attempting to delete the service, typically indicating success or failure status.

Dependencies

  • Portainer API access with an API key credential

Troubleshooting

  • Ensure the Environment ID and Service ID are correct and correspond to existing resources in Portainer.
  • If force deletion is not enabled and the service is in use, the deletion may fail; enable 'Force Delete' to override this behavior.
  • Check API key permissions to ensure the user has rights to delete services in the specified environment.
  • Network or connectivity issues to the Portainer API endpoint can cause request failures; verify network access and proxy settings if used.

Links

Discussion