Use Docker compose
Launch a composition and define a service environment variable using a file
At times when launching a composition, you need to pass many environment variables to a specific service.
To do so, you can use docker-compose 'env_file'
field on any service, and use files from the current working directory from which the composition is being launched.
This works for both composition
and launch-composition
step types.
NOTE:
When launching a composition directly from the Compositions view, usingenv_file
does not work as it is being launched in an empty working directory.
Consider moving the composition launch as part of a usual pipeline which will give you ability to use files from your cloned repository.
Examples
Compositions are launched within a working directory, which is the cloned repository by default.
This means that you can always reference an env_file
just as would reference a docker-compose
file.
Inline Composition
version: '1.0'
steps:
inline_composition:
title: Launch inline composition
type: launch-composition
environment_name: 'environment name'
composition:
version: '3'
services:
service:
image: alpine
env_file: ./env-file
Composition from file
version: '1.0'
steps:
composition_from_file:
title: Launch composition from file
type: launch-composition
composition: './docker-compose.yml'
environment_name: 'environment name'