Pass argument to docker compose

前端 未结 4 1421
失恋的感觉
失恋的感觉 2020-12-08 01:36

In my docker compose file there is a dynamic field which I\'d like to generate during the running. Actually it is a string template:

environment:
    - SERVE         


        
4条回答
  •  猫巷女王i
    2020-12-08 02:19

    You can use the flag when using docker-compose build

    docker-compose build --build-arg PRODUCTION=VALUE
    

    In Dockerfile you can get the argument PRODUCTION

    # Dockerfile
    ARG PRODUCTION
    FROM node:latest
    

提交回复
热议问题