I have a bash script that reads a csv file line by line.
After every reading each line it will execute docker cp
command.
However when it is executed the script fails to copy the files in the container.
INPUT=FileIdsToRemove.csv
COPYDIR=/var/lib/mayan/document_file_storage
OLDIFS=$IFS
IFS=','
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; }
while read fileuuid
do
echo "uuid : $fileuuid";
docker cp mayan_app_1:/var/lib/mayan/document_file_storage/"$fileuuid" ./;
done < $INPUT
IFS=$OLDIFS
output:
uuid : 87d46881-0839-4ae1-aa20-3a056c2848c1
Error: No such container:path: mayan_app_1:/var/lib/mayan/document_file_storage/87d46881-0839-4ae1-aa20-3a056c2848c1
I am able to copy each file when I execute docker cp in the terminal instead of executing the script.
docker cp mayan_app_1:/var/lib/mayan/document_file_storage/0fd5196e-fd01-44f7-91dc-ef1c9c5408f4 ./
Below is the csv file content for reference
fileuuid
c61bd18a-47ef-448e-a04c-fd95b40d70c5
79c473e3-2f16-444e-9fe7-e02ce53f046f
87d46881-0839-4ae1-aa20-3a056c2848c1
16b1dc1f-e10f-4681-896a-d8fb3c421d22
792b363c-fa23-4f07-85a6-daa33ec4c5bd