these are my first steps in docker and i have the following problem: What is the best way to copy a file from a host to the Docker container?
I installed Docker from Gilbert Tanner to https://gilberttanner.com/blog/tensorflow-object-detection-with-tensorflow-2-creating-a-custom-model on my Linux desktop Ubuntu 18.04.
The used Docker version is 19.03.13, API 1.40 linux/amd64.
Now I want to copy one or more files from the host into the Docker container. In the tutorials the syntax is “docker cp foo.txt mycontainer:/”.
is executed, no error message is displayed, but no file is copied.
Also I have:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
54e99d73543f od “/bin/bash” 2 hours ago Up 2 hours compassionate_bartik
and i do
docker cp test.txt compassionate_bartik:/
I donẗ get a file in my container. But also no error message.
Only the following method works:
tar -cv *.txt | docker exec -i compassionate_bartik tar x -C .
What am I doing wrong with the method with cp?