bwnyasse
bwnyasse

Reputation: 629

Interpolate variables in environment variables definition with docker-compose.yml

How can I interpolate env vars when using docker-compose . if I have a following vars.env file :

VAR_1=value_1
VAR_2=value_1/value2
VAR_3=value_1/value3

I would like to interpolate using of VAR_1 like this

VAR_1=value_1
VAR_2=${VAR_1}/value2
VAR_3=${VAR_1}/value3

But it is not working. Any idea ?

Upvotes: 1

Views: 3316

Answers (1)

dnephin
dnephin

Reputation: 28080

This is not supported. You can however use an .env file to set the value of $VAR_1: https://docs.docker.com/compose/env-file/

Upvotes: 1

Related Questions