更新时间:2023-02-15 17:37:51
我能够通过将多行环境变量作为构建arg传递给docker build来使它正常工作。
I was able to get this working by passing the multiline environment variable as a build arg to docker build.
Dockerfile
FROM ubuntu:latest
ARG CONFIG
ENV CONFIG $CONFIG
构建命令
CONFIG="port: 4466
databases:
prod:
connector: mysql
active: true
host: 33.333.333.333
port: 3306
user: root
password: pass"
docker build --build-arg CONFIG="$CONFIG" ubuntu:latest env | grep 'CONFIG'