Search code examples
dockercopycontainers

Unable to copy file from Docker container to host


$ docker cp maven-container_:xxxx.war /home/wissem/Documents/docker-stage/wildfly-configured/target/

Error response from daemon: lstat

/var/lib/docker/aufs/mnt/afbdc7f4ce3165fb2e6c34929841b9fa911de1978887dd5b9b0804e4f624af2d /xxxx.war: no such file or directory

ERROR: Job failed: exit status 1


Solution

  • 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/