buildkit icon indicating copy to clipboard operation
buildkit copied to clipboard

WCOW: support for ${variable?} syntax on Windows containers requires further investigation

Open danielGithinji opened this issue 4 months ago • 1 comments

Given the dockerfile below, when you try to build an image using both buildkit and docker you get a failed to solve and failed to process error, respectively as shown below:

Dockerfile

FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
ARG FOO
ARG BAR=${FOO:?"foo missing"}

Docker build command and result

docker build -t simple-tester .

Sending build context to Docker daemon  608.3MB
Step 1/3 : FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
 ---> b9775a86954e
Step 2/3 : ARG FOO
 ---> Running in 9c414763ba53
 ---> Removed intermediate container 9c414763ba53
 ---> 01247249fe8f
Step 3/3 : ARG BAR=${FOO:?"foo missing"}
failed to process "${FOO:?\"foo missing\"}": FOO: foo missing

Buildkit build command and result


buildctl build `
>> --frontend=dockerfile.v0 `
>> --local context=. \ `
>> --local dockerfile=. `
>> --output type=image,name=simple-tester,push=false `
>> --progress plain `
>> --no-cache

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 127B done
#1 DONE 0.0s

#2 [internal] load metadata for mcr.microsoft.com/windows/nanoserver:ltsc2022
#2 DONE 1.0s

#3 [internal] load .dockerignore
#3 transferring context: 2B done
#3 DONE 0.0s
Dockerfile:3
--------------------
   1 |     FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
   2 |     ARG FOO
   3 | >>> ARG BAR=${FOO:?"foo missing"}
--------------------
error: failed to solve: failed to process "${FOO:?\"foo missing\"}": FOO: foo missing

Since both buildkit and classic docker don't seem to have support for this kind of syntax for Windows containers, it requires further investigation and a possible feature proposal in the future.

danielGithinji avatar Oct 15 '24 06:10 danielGithinji