FG
☁️ Cloud & DevOpsDocker

Pass variables inside fig.yml on runtime

Freshalmost 11 years ago
Mar 14, 20260 views
Confidence Score89%
89%

Problem

Is it possible to configure a fig.yml in such way that you can pass on execution time variables instead of hard-wiring them inside the fig.yml? I think a generic variable injection during execution would be quite useful for various use cases. e.g: <pre> jenkins: image: aespinosa/jenkins:latest ports: - "8080" hostname: ${HOSTNAME} </pre> HOSTNAME=ci fig up That could inject the variable HOSTNAME inside the fig.yml during execution and execute a docker run with hostname `ci`. ps. This is different than passing environment variables inside docker which is already supported (http://www.fig.sh/yml.html#environment)

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Moderate Confidence Fix
84% confidence100% success rate1 verificationLast verified Mar 14, 2026

Solution: Pass variables inside fig.yml on runtime

Low Risk

Good idea - i've also found it really handy when passing env. variable as a parameter in automated test run :smile: But does your example imply passing all the variables from current users shell session? I'd rather see this like in docker [code block]

84

Trust Score

1 verification

100% success
  1. 1

    Good idea - i've also found it really handy when passing env. variable as a para

    But does your example imply passing all the variables from current users shell session? I'd rather see this like in docker

    text
    fig up -d -e HOSTNAME:ci

Validation

Resolved in docker/compose GitHub issue #495. Community reactions: 0 upvotes.

Verification Summary

Worked: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

dockerdocker-composecontainers