Unable to copy file from Docker container to host

You need to copy from a running instance and not an image. So I assume maven-container_ is a name of the container your had launched and not a image. Also use complete path after :,

docker cp maven-container_:/path/inside/container/xxxx.war /home/wissem/Documents/docker-stage/wildfly-configured/targe‌​t/

For me it didn't work because of permissions. The file I was trying to copy was owned by postgres user, while the default user seems to be root.


I got this error when trying to copy a file under the root folder (seems related to @uthomas's answer).

$ docker cp dreamy_brown:/root/myfile.txt ~
Error: No such container:path: dreamy_brown:/root/myfile.txt

Solution: From within the container I first moved the file to the /tmp folder:

$ mv /root/myfile.txt /tmp

and then I was able to copy it to the host:

$ docker cp dreamy_brown:/tmp/myfile.txt ~