Portainer icon

Portainer

Work with Portainer API data to manage Docker

Secret → Create

AI-generated

Overview

This node operation creates a new Docker Swarm secret in a specified environment using the Portainer API. It is useful for securely managing sensitive data such as passwords, tokens, or keys within Docker Swarm clusters. For example, a user can create a secret to store database credentials that containers can access securely.

Use Case Examples

  1. Creating a secret named 'db_password' with the actual password data encoded and stored securely in the Docker Swarm environment with ID '1'.
  2. Automating secret creation as part of a CI/CD pipeline to manage sensitive configuration data.

Properties

Name Meaning
Environment ID The ID of the environment/endpoint in Portainer where the secret will be created.
Secret Name The name identifier for the secret to be created.
Secret Data The sensitive data content of the secret, which will be base64 encoded before sending to the API.
Request Options Additional request options such as batching, SSL certificate validation, proxy settings, and timeout configuration.

Output

JSON

  • body - The JSON response body from the Portainer API after creating the secret, containing details of the created secret.

Dependencies

  • Portainer API with an API key credential for authentication

Troubleshooting

  • Ensure the Environment ID is correct and accessible in Portainer to avoid authorization errors.
  • Secret Data must be provided and will be base64 encoded; empty or invalid data may cause API errors.
  • If SSL certificate validation is disabled, be aware of potential security risks.
  • Timeouts can occur if the Portainer server is unresponsive; adjust the timeout setting accordingly.

Links

Discussion