简体   繁体   中英

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 ?

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM