Reputation: 23472
I have folder with files common for multiple docker images. How can I COPY
these files to the image referencing the parent directory in Dockerfile? Obviously I don't want to duplicate this folder to all Docker projects.
Upvotes: 12
Views: 23167
Reputation: 13260
When you run docker build
the latest parameter is called PATH
. Here is a description of it taken from here:
The docker build command builds Docker images from a Dockerfile and a “context”. A build’s context is the set of files located in the specified PATH [omissis]. The build process can refer to any of the files in the context. For example, your build can use a COPY instruction to reference a file in the context.
That means you have to specify a PATH
that contains all of the files you need in your Dockerfile. Please be aware that changing the PATH
to a different directory will require changing all of your COPY
and ADD
instructions to reflect the new directory structure.
Upvotes: 3