Docker: One or more build-args [SSH_PRIVATE_KEY] were not consumed (but it should have)

  docker, docker-build, warnings

I have this Dockerfile snippet:

FROM alpine/git:v2.26.2 as intermediate

RUN mkdir /root/.ssh/ && chmod 755 /root/.ssh
RUN echo "${SSH_PRIVATE_KEY}" > /root/.ssh/id_ed25519 && chmod 600 /root/.ssh/id_ed25519

It is run using this command:

docker build --build-arg SSH_PRIVATE_KEY="$(cat ~/.ssh/id_ed25519_runbot)" --tag org/name .

I also checked this question Docker, one or more build-args where not consumed

So it looks I’m doing same thing as suggested. But I’m still getting this warning:

[Warning] One or more build-args [SSH_PRIVATE_KEY] were not consumed

Docker version 19.03.13, build 4484c46d9d

P.S. I know that such warning is usually harmless, but I want to understand what am I doing wrong and why it is giving that warning when I think it should not?

Source: Docker Questions