docker / awesome-compose

Awesome Docker Compose samples

Home Page:https://docs.docker.com/compose/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cannt read variable from docker compose build --build-arg xx=xx

YesPass opened this issue · comments

version: '3.1'
services:
  sample:
    restart: always
    build:
      context: ./ 
      dockerfile: Dockerfile
      args:
        GOLDFLAGS: "${GOLDFLAGS?err}"
    image: sample:1.0.0
    container_name: sample0
    ports:
      - 8080:8080
    environment:
      TZ: Asia/Shanghai

it appears error

error while interpolating services.sample.build.args.GOLDFLAGS: required variable GOLDFLAGS is missing a value: err

when execute command

 docker compose build --build-arg GOLDFLAGS="-s -w"

docker version :4.21.1
docker compose version: 2.19.1