Dockerfile and dev/test/prod environment

后端 未结 3 1286
情歌与酒
情歌与酒 2020-12-17 04:05

I want to create Dockerfile that will be able to build three different images (one at the moment). Those images differs only in configuration files.

I was trying: <

3条回答
  •  星月不相逢
    2020-12-17 04:38

    Why not copy in your Dockerfile all 3 config files, and then docker run -e config=file1 (or file2 or file3) and use the value of config environment variable to get the required config file .Check the doc http://docs.docker.com/reference/commandline/cli/#run

    You can also use the --env-file=[] Read in a line delimited file of environment variables of the docker run command.

    You can check that environment variable is available with docker run -it -e mytag=abc123 ubuntu:latest env | grep mytag shows mytag=abc123

提交回复
热议问题