Menu
Introduction
Getting Started
Developer guide
Release
Architecture
CLI
Technical documentations
Version
Publication date

Mar 9, 2022

Confidentiality
Public
Reactions
1
Share

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

  1. Input Priority: If a file input is provided, it takes precedence over the config parameter
  2. Validation: Checks that either file input or config parameter contains YAML configuration
  3. Brick Validation: Verifies that the specified brick exists in the system
  4. Deployment: Starts the Docker Compose using the YAML configuration
  5. 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

## Example Docker Compose YAML configuration
version: '3.8'
services:
  web:
    image: nginx:latest
    ports:
      - "80:80"
    environment:
      - ENV_VAR=value

Input

Docker Compose YAML File
Optional YAML file for Docker Compose configuration
Optional

Output

Docker Compose Response
Response from Docker Compose start operation

Configuration

yaml_config

Optional

YAML configuration for Docker Compose (used if no file input provided)

Type : yaml_code_param

brick_name

Name of the brick

Type : string

unique_name

Unique name for the compose

Type : string

description

Description of the compose instance

Type : string

env

Optional environment variables for the compose as JSON object. Must be a Dict[str, str]

Type : json_code_param

auto_start

Optional

Whether to automatically start the compose on lab start

Type : bool
Shine Logo
Technical bricks to reuse or customize

Have you developed a brick?

Share it to accelerate projects for the entire community.