Error response from daemon: dockerfile parse error line 1: FROM requires either one or three arguments
This occurs because Image Builder is incorrectly rewriting the Dockerfile to target the locally built tag instead of the public MCR tag. It ends up replacing the whitespace between the end of the tag and the AS keyword, producing this FROM instruction: FROM dotnetdocker.azurecr.io/build-staging/2090449/dotnet-buildtools/prereqs:ubuntu-20.04-crossdeps-localAS binutils. Notice there's no space before AS. This is invalid syntax and causes the error to occur.
This is fixed by using the correct character class in the Regex which does the string replacement. The string its search to replace should stop before hitting any whitespace (\s) but it was using the non-whitespace character class (\S).
The changes from https://github.com/dotnet/dotnet-buildtools-prereqs-docker/pull/754 caused a failure in the internal build:
This occurs because Image Builder is incorrectly rewriting the Dockerfile to target the locally built tag instead of the public MCR tag. It ends up replacing the whitespace between the end of the tag and the
AS
keyword, producing thisFROM
instruction:FROM dotnetdocker.azurecr.io/build-staging/2090449/dotnet-buildtools/prereqs:ubuntu-20.04-crossdeps-localAS binutils
. Notice there's no space beforeAS
. This is invalid syntax and causes the error to occur.This is fixed by using the correct character class in the Regex which does the string replacement. The string its search to replace should stop before hitting any whitespace (
\s
) but it was using the non-whitespace character class (\S
).