Actions72
- Image Actions
- Config Actions
- Container Actions
- Edge Group Actions
- Edge Stack Actions
- Network Actions
- Node Actions
- Registry Actions
- Secret Actions
- Service Actions
- Stack Actions
- Team Actions
- Template Actions
- User Actions
- Volume Actions
- Webhook Actions
Overview
This node integrates with the Portainer API to manage Docker containers programmatically. Specifically, the Container - Create operation allows users to create new Docker containers on a specified environment (endpoint) managed by Portainer.
Typical use cases include automating container deployment workflows, spinning up containers with specific configurations, or integrating container creation into larger automation pipelines. For example, you could automatically deploy an Nginx container with custom environment variables and port mappings whenever a new application version is released.
Properties
| Name | Meaning |
|---|---|
| Environment ID | The ID of the Portainer environment/endpoint where the container will be created. |
| Container Name | Optional name to assign to the new container. |
| Image | Docker image to use for the container (e.g., nginx:latest). |
| Command | Command to execute inside the container upon start (split by spaces). |
| Environment Variables | List of environment variables to set inside the container, each with a name and value. |
| Exposed Ports | Comma-separated list of ports to expose from the container (e.g., 80,443). |
| Port Bindings | Comma-separated port mappings in containerPort:hostPort format (e.g., 80:8080,443:8443). |
| Restart Policy | Container restart policy; options are: No, Always, Unless Stopped, On Failure. |
Output
The node outputs the JSON response returned by the Portainer API after creating the container. This typically includes details such as the container ID, warnings, and other metadata about the newly created container.
No binary data output is involved in this operation.
Dependencies
Requires a configured Portainer API credential with:
- Base URL of the Portainer instance.
- An API key for authentication.
The node sends HTTP POST requests to the Portainer API endpoint corresponding to the selected environment.
Troubleshooting
Common issues:
- Invalid or missing Environment ID: Ensure the environment ID corresponds to a valid Portainer endpoint.
- Incorrect image name or tag: Verify the Docker image exists and is accessible.
- Port conflicts: Specified host ports may already be in use on the target environment.
- Insufficient permissions: The API key must have rights to create containers on the environment.
Error messages:
- Authentication errors: Check that the API key is correct and has not expired.
- 404 Not Found: The environment ID or API endpoint might be incorrect.
- 400 Bad Request: Usually indicates malformed input, such as invalid port bindings or environment variable formats.
Resolving these usually involves verifying credentials, input parameters, and ensuring the Portainer server is reachable.
Links and References
- Portainer API Documentation
- Docker Container Create API (underlying Docker API used by Portainer)