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

Open
opened 2026-03-07 21:21:47 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @YesPass on GitHub (Aug 3, 2023).

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

Originally created by @YesPass on GitHub (Aug 3, 2023). ``` docker-compose.yml 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 ``` shell docker compose build --build-arg GOLDFLAGS="-s -w" ``` docker version :4.21.1 docker compose version: 2.19.1
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/awesome-compose#689