Is it possible to copy multiple files to different locations in a Dockerfile
?
I'm looking to go from:
COPY outputs/output/build/.tools /root/.tools
COPY outputs/output/build/configuration /root/configuration
COPY outputs/output/build/database/postgres /root/database/postgres
I have tried the following, but no joy:
COPY ["outputs/output/build/.tools /root/.tools","outputs/output/build/configuration /root/configuration","outputs/output/build/database/postgres /root/database/postgres"]
Not sure if this is even possible.
Create a file
.dockerignore
in yourdocker
build context directory. Create a soft link (ln
) of the root directory you want to copy and exclude the directories you don't want in your.dockerignore
.In your case, you don't need the soft link as the directory is already in the
docker
build context. Now, add the directories in the.dockerignore
file that you don't want eg. if you don't wantbin
directory you can do that as,Finally in your
Dockerfile
,Details are here.