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

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable