Docker Community Forums

Share and learn in the Docker community.

Strange file status on docker cp


(Utahguy) #1

When I copy a file into my container using docker cp, it sometimes doesn’t copy correctly and creates a corrupt file in a strange state. Does anyone know what’s going on?

Mac OS: Sierra 10.12.5
Docker version: 17.06.1-ce

We first tried to copy loinc.csv:

docker cp /loinc.csv mediyeti-5435-drugdb:/

This resulted in the error. Then, we tried to copy loinc_copy.csv, which worked:

docker cp /Users/mediyeti/Downloads/LOINC_2.61_Text/loinc_copy.csv mediyeti-5435-drugdb:/


docker exec mediyeti-5435-drugdb bash
root@edc59e39cbc9:/# ls -lart
ls: cannot access RXNREL.RRF: No such file or directory
ls: cannot access loinc.csv: No such file or directory
ls: cannot access RXNSAT.RRF: No such file or directory
total 496196
-?????????   ? ?    ?               ?            ? RXNSAT.RRF
-?????????   ? ?    ?               ?            ? RXNREL.RRF
-?????????   ? ?    ?               ?            ? loinc.csv
-rwxr-xr-x   1  501 dialout  55472844 Jun 22 19:27 loinc_copy.csv

You can see that this also occurred on two other files we tried copying into the container.

Just create a copy and try again. It’s an intermittent error, so it will likely succeed the second time.