Dockerfile ARG with no default value and no value provided produces no error

Should the following Dockerfile produce an error when invoked via docker build -f Dockerfile . --no-cache? I think there are two reasons that it should – (a) no value for ARG_NO_DEFAULT and (b) COPY requires 2 args, but has (actually) none.

I’m probably missing something! Thx for any advice.

FROM postgres:latest
ARG ARG_NO_DEFAULT

COPY $ARG_NO_DEFAULT $ARG_NO_DEFAULT

Docker version is 20.10.6, build 370c289 running on a Mac M1 under Big Sur.

1 Like