Publication dateMar 9, 2022
Confidentiality public Public
Start Docker Compose Task
TASK
Typing name : TASK.gws_core.StartDockerComposeTask Brick : gws_core Start a Docker Compose from YAML configuration
Start Docker Compose Task
A task that starts a Docker Compose service from YAML configuration.
Overview
This task allows you to deploy and start Docker containers using Docker Compose configuration.
It validates the existence of the specified brick, processes the YAML configuration, and
initiates the Docker Compose deployment through the Docker service.
Input/Output
- Inputs:
yaml_file (optional): File resource containing Docker Compose YAML configuration
- Output:
JSONDict resource containing the Docker Compose operation response
Configuration Parameters
| Parameter |
Type |
Required |
Description |
yaml_config |
YamlCodeParam |
Conditional |
YAML configuration for Docker Compose (required if no file input provided) |
brick_name |
StrParam |
Yes |
Name of the brick (must exist in the system) |
unique_name |
StrParam |
Yes |
Unique identifier for this compose instance |
Behavior
- Input Priority: If a file input is provided, it takes precedence over the config parameter
- Validation: Checks that either file input or config parameter contains YAML configuration
- Brick Validation: Verifies that the specified brick exists in the system
- Deployment: Starts the Docker Compose using the YAML configuration
- Response: Returns a structured JSON response with deployment status and output
Output Format
The output JSONDict contains:
message: Status message from the Docker service
output: Detailed output from the Docker Compose operation
brick_name: The brick name used for deployment
unique_name: The unique name assigned to this compose instance
Exceptions
BadRequestException: Raised if:
- Neither file input nor config parameter is provided
- The specified brick does not exist
- Docker service exceptions: May be raised during compose deployment
Usage Options
Option 1: Using File Input
Connect a File resource containing your docker-compose.yml to the yaml_file input.
The config yaml_config parameter can be left empty.
Option 2: Using Config Parameter
Leave the yaml_file input unconnected and provide the YAML configuration
directly in the yaml_config parameter using the YAML code editor.
Example YAML Configuration
version: '3.8'
services:
web:
image: nginx:latest
ports:
- "80:80"
environment:
- ENV_VAR=value
login
Input
Docker Compose YAML File
Optional YAML file for Docker Compose configuration
Optional
logout
Output
Docker Compose Response
Response from Docker Compose start operation
settings
Configuration
YAML configuration for Docker Compose (used if no file input provided)
Type : yaml_code_paramName of the brick
Type : stringUnique name for the compose
Type : stringDescription of the compose instance
Type : stringOptional environment variables for the compose as JSON object. Must be a Dict[str, str]
Type : json_code_paramWhether to automatically start the compose on lab start
Type : boolTechnical bricks to reuse or customize Have you developed a brick?
Share it to accelerate projects for the entire community.