Actions86
- Config Actions
- Container Actions
- Edge Group Actions
- Edge Stack Actions
- Environment Actions
- Image Actions
- Network Actions
- Node Actions
- Registry Actions
- Secret Actions
- Service Actions
- Setting Actions
- Stack Actions
- System Actions
- Team Actions
- Template Actions
- User Actions
- Volume Actions
- Webhook Actions
Secret → Create
AI-generatedOverview
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
- Creating a secret named 'db_password' with the actual password data encoded and stored securely in the Docker Swarm environment with ID '1'.
- 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
- Portainer API - Create a Secret - Official documentation for creating Docker Swarm secrets via the Portainer API.