You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
findBaseImage in dockerfileUtils.ts does not handle buildkit automatic variables in layers name #275
Giving a simple Dockerfile example, leveraging the TARGETARCHautomatic variable provided in the global scope by buildkit:
ARG APT_FLAGS="-y -qq --no-install-recommends --no-install-suggests"FROM node AS base-arm64
ONBUILDARG PACKAGES="\ build-essential \ python3 \"FROM node AS base-amd64
ONBUILDARG PACKAGES=""FROM base-${TARGETARCH} AS base
apt-get install ${APT_FLAGS} ${PACKAGES}
# do common stuff
The TARGETARCH global scope variable (Nor for that matter any others) does not seem available for replacement when searching the base image in the findBaseImage function called by internalGetImageBuildInfoFromDockerfile during the build
in our case ending up returning the value base- which does not exist and then fails:
[1197 ms] Start: Run: docker inspect --type image base-
[3802 ms] Error fetching image details: No manifest found for docker.io/library/base-.
[3802 ms] Start: Run: docker pull base-
invalid reference format
[3903 ms] []
[3903 ms] Error response from daemon: no such image: base-: invalid reference format
Also, another issue I found along the way when inspecting available values, parsing does not handle quoted values (nor multilines). Based on the previous Dockerfile example, we end up in the provided replacements to replaceVariables function with:
Christof Marti (@chrmarti) Additionally, trying to find a workaround in the meantime, I just noticed that parsing of variables with replacements (ie. ${FOO:-bar}) does not work either.
With something like:
ARG ARCH=${TARGETARCH:-amd64}
# [...]FROM base-${ARCH} AS base
# [...]
The CLI complains:
[63348916 ms] Start: Run: docker inspect --type image base-:-amd64}
[63351485 ms] Error fetching image details: No manifest found for docker.io/library/base-:-amd64}.
[63351485 ms] Start: Run: docker pull base-:-amd64}
invalid reference format
[63352081 ms] []
[63352081 ms] Error response from daemon: no such image: base-:-amd64}: invalid reference format
[63352081 ms] Command failed: docker inspect --type image base-:-amd64}
Activity
sylver commentedon Nov 9, 2022
Christof Marti (@chrmarti) Additionally, trying to find a workaround in the meantime, I just noticed that parsing of variables with replacements (ie.
${FOO:-bar}) does not work either.With something like:
The CLI complains:
rawler commentedon Feb 19, 2026
Any triage or plans for this?