How to copy files to docker container from a location OTHER THAN host machine?
That is not really possible.
COPYobeys the following rules:
<src>path must be inside the context of the build; you cannot
COPY ../something /something, because the first step of a
docker buildis to send the context directory (and subdirectories) to the docker daemon.
ADD. So the only way to do what you want is to mount the remote server/resource inside of your build directory. I have sometimes used Amazon S3 to fetch the files to the local directory, for example when we build the same base image but for different customers what needs their own custom files inside of the image.
Thank you so much for your response.
Can you please give more information about how to " mount the remote server/resource inside of your build directory."? I didn’t get it.
It depends on the involved systems. But I’ve used S3FS to mount resources stored in AWS on the local build machine. A good blog on that is found at https://cloud.netapp.com/blog/amazon-s3-as-a-file-system