Given the following configuration:
mysql:
environment:
MY_MYSQL_PORT:
image: mysql
ports:
- "${MY_MYSQL_PORT}:3306"
There's a way to provide a fallback value for MY_MYSQL_PORT without relying on wrapper scripts? I already tested like bash ${MY_MYSQL_PORT-3306} but it doesn't work.
They implemented that feature with compose 1.9 release:
Added support for shell-style inline defaults in variable interpolation.
The supported forms are ${FOO-default} (fall back if FOO is unset) and ${FOO:-default} (fall back if FOO is unset or empty).
Dockerfile 文档中的解释可以在以下位置找到: https ://docs.docker.com/engine/reference/builder/#environment-replacement
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.