buildkit icon indicating copy to clipboard operation
buildkit copied to clipboard

Build secret mount destination not created when specified with a build argument

Open schradert opened this issue 2 years ago • 1 comments

My Dockerfile directives look like:

ARG SECRET_PATH=/my/secret/path
RUN --mount=type=secret,id=mysecret,dst=${SECRET_PATH} \
    cat ${SECRET_PATH}

This errors out as cat: /my/secret/path: No such file or directory when built with DOCKER_BUILDKIT=1 docker build --secret id=mysecret,src=mysecret.txt .

It does work correctly when simply hardcoded as RUN --mount=type=secret,id=mysecret,dst=/my/secret/path ....

Can anybody reproduce this? If not possible now, is there a reason why this isn't already supported? It doesn't really matter that much obviously because it doesn't affect the container at runtime and it can be all hardcoded but I was confused for a while why this wasn't working and thought I'd file an issue.

schradert avatar Jul 11 '22 18:07 schradert

What version of Dockerfile are you using. Variables were added in 1.2 iirc.

tonistiigi avatar Jul 20 '22 16:07 tonistiigi