Douglas Dias da Silva
Douglas Dias da Silva

Reputation: 115

Docker cp: Error response from daemon: lstat no such file or directory

I'm learning about containers docker, I'm still in the basics.. When I try to use the command docker cp,to copy an file from the container to the local host direcotory the output returns an error. I type:

docker cp bridge:/home/arq3.txt .

the output:

Error response from daemon: lstat /var/lib/docker/aufs/mnt/231afc03ee896d66b09ed3c4d1d057a73eeed4f6182c3108dcbfb5b3337c8fa5/home/arq3.txt: no such file or directory

Second the documentation of docker the syntax is right, so what I doing wrong? And what is this directory var/lib/docker/aufs/mnt/231afc03ee896d66b09ed3c4d1d057a73eeed4f6182c3108dcbfb5b3337c8fa5/?

Upvotes: 4

Views: 15593

Answers (4)

Akshay
Akshay

Reputation: 1901

Probably missing "/app" tag in the beginning. Try following command -

docker cp bridge:/app/home/arq3.txt .

Earlier I was using following command to find location of a file -

docker exec -it bridge /bin/sh

When I tried following command, it showed "/app" directory

docker exec -it bridge /bin/bash

Upvotes: 0

smoore4
smoore4

Reputation: 4866

Your file is there. It is the docker name ("bridge") that is wrong. You probably did like me and ran docker ps to get a list of images, then - logically - used the image name to connect.

The problem is that you started a new image and it has a different name. You want to open a different ssh connection while Docker is running and run docker ps again. This time you will see an additional image name. Use the new one and the docker cp command should work.

Upvotes: 0

podarok
podarok

Reputation: 535

I had a similar issue when manually removed files from /var/lib/docker/aufs

To get docker functional back I had to remove all images and all container

docker ps -asq | xargs docker rm -f 

Afterward, I've removed all images

docker images -q | xargs docker rmi

And then restarted all docker containers I needed.

Upvotes: 0

xhienne
xhienne

Reputation: 6144

The error tells you that there is no file /home/arq3.txt in your Docker container. Check the file path. The file is probably not in /home but in /home/<user> or in /root.

As for /var/lib/docker/aufs/mnt/231afc03ee896d66b09ed3c4d1d057a73eeed4f6182c3108dcbfb5b3337c8fa5, it is the mount point of your Docker file hierarchy.

Upvotes: 2

Related Questions