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
Service → Create
AI-generatedOverview
This node operation creates a new Docker Swarm service in a specified environment using the Portainer API. It allows users to define the service name, Docker image, number of replicas, and environment variables for the service container. This operation is useful for automating the deployment and management of Docker Swarm services within a Portainer-managed environment.
Use Case Examples
- Automate deployment of a web application service using a specific Docker image and environment variables.
- Create multiple instances of a microservice by specifying the number of replicas.
- Set up a new service in a Docker Swarm cluster managed by Portainer with custom environment variables.
Properties
| Name | Meaning |
|---|---|
| Environment ID | The ID of the environment/endpoint in Portainer where the service will be created. |
| Image | The Docker image to use for the service container. |
| Environment Variables | A collection of environment variables to set inside the service container. |
| Service Name | The name to assign to the new Docker Swarm service. |
| Replicas | The number of replicas (instances) of the service to run. |
Output
JSON
Name- The name of the created service.TaskTemplateContainerSpec
*Image- The Docker image used by the service container.
*Env- The environment variables set for the service container.
ModeReplicated
*Replicas- The number of replicas configured for the service.
Dependencies
- Portainer API with an API key credential for authentication
Troubleshooting
- Ensure the Environment ID is correct and the Portainer endpoint is accessible.
- Verify the Docker image name is valid and accessible from the environment.
- Check that the API key credential has sufficient permissions to create services.
- If environment variables are not applied, ensure they are correctly formatted as name-value pairs.
Links
- Portainer API - Create Service - Official Portainer API documentation for creating Docker Swarm services.