--build-arg
option--build-arg
in advance.docker-compose build --build-arg BUILDID=4d345663-5247-465d-b522-1d3c08b5d243
docker-compose --Specify with args --At this time, the value of the variable is overwritten, so it is appropriate.
docker-compose.yaml
version: '3.7'
services:
app:
build:
context: ./app
dockerfile: ./Dockerfile
args:
- BUILDID=test
Dockerfile --Read with ARG --Embed with ENV
ARG BUILDID
ENV buildid=${BUILDID}