Copy Multiple Local Files To Docker Container


Answer :

There is a proposal for docker cp to support wildcards (7710), but it is not implemented yet.



So that leaves you with bash scripting, using docker cp for each file:



for f in data/*txt; do docker cp $f sandbox_web_1:/usr/src/app/data/; done


The following command should copy whole directory data with its content of a data directory to your desired destination:



docker cp data/ sandbox_web_1:/usr/src/app/


Tested on Docker version 1.12.1, but I haven't found any changes to a cp command in a the release 1.12.1



I am on Docker version 18.09 and found that I was able to copy all the files from my current local directory to the container's root by running:
docker cp ./ image_name:



Comments

Popular posts from this blog

530 Valid Hostname Is Expected When Setting Up IIS 10 For Multiple Sites

C Perror Example

Converting A String To Int In Groovy