Description
openedon Nov 16, 2021
We have a docker-compose.yml
that specifies a build argument that is pulled from a boolean environment variable of false
, but is explicitly quoted in docker-compose.yml
.
When running a build with docker buildx bake
we receive an error that the argument must be a string, number of null
Below is a minimal reproducible example that outlines the issue:
Dockerfile
FROM centos:8
ARG TEST_BOOLEAN
RUN echo $TEST_BOOLEAN
docker-compose.yml
version: '3.2'
services:
app:
image: "test-boolean"
restart: always
user: root
build:
context: .
dockerfile: Dockerfile
args:
TEST_BOOLEAN: "${TEST_BOOLEAN}"
If we set export TEST_BOOLEAN=false
and then run docker buildx bake
it fails with the below:
[+] Building 0.0s (0/0)
error: services.app.build.args.TEST_BOOLEAN must be a string, number or null
This is the same if we export it as false
, 'false'
or "false"
.
Exporting export TEST_BOOLEAN='"false"'
appears to work.
If we instead change docker-compose.yml
to hardcode the false value (rather than pull from env var) as per below, the build succeeds:
version: '3.2'
services:
app:
image: "test-boolean"
restart: always
user: root
build:
context: .
dockerfile: Dockerfile
args:
TEST_BOOLEAN: "false"
We are seeing the error on buildx version 0.6.3
. On an older version, 0.5.1
, the issue is not present
Perhaps related to either https://github.com/docker/buildx/pull/669/files or https://github.com/docker/buildx/pull/704/files