I want to make a folder on my host machine available during a RUN
statement. That is, similar to the effect of a container run with -v
:
docker run -v /path/on/host:/path/in/container mycontainer:tag
In the container this gives me /path/in/container
with all files/folder in path/on/host
.
To this end I am trying the experimental mount options from https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/experimental.md:
RUN --mount=type=bind,target=/path/on/host
This gives me a folder /path/on/host
during the RUN
.
I then have two problems:
I can
ls
files inside/path/on/host
, but not use them (e.g.cat
them). I have tried changingtype
to e.g.cache
and usingsource
like in https://devops.stackexchange.com/questions/6078/in-a-dockerfile-is-there-a-way-to-avoid-copying-files-to-make-them-accessible-t, but I cannot make it work.I cannot figure out how to have a different path inside the "
RUN
image", that is,/path/in/container
instead of/path/on/host
.