Are you using Docker Desktop? I think I saw this issue only with Docker Desktop when the file on the host had wrong permissions and the in the VM the file was listed but somehow the VM didn’t have right to actually access it. I don’t remember the details.
In this case it is not a bind mount, but copy so it is not the same issue.
And the ls command shows a dot character in the list of permissions which shouldn’t be there normally.
I updated your post to use a code block. So we can see it better. Please follow this guide to share codes, logs or terminal outputs.
Can you copy the file anywhere else in the container?
Looks like I’m facing a suspiciously similar issue and I would appreciate if someone could shed some light on the root cause.
admin@lab01:~/containers/mattermost$ docker exec -ti 3041657a2d9892f41f5083a2a5d6256af55615deba247b0a5cc9d60b25a8cc10 stat /tmp/mm-export-01-aug-2024
File: /tmp/mm-export-01-aug-2024
Size: 160957303 Blocks: 314376 IO Block: 4096 regular file
Device: 91h/145d Inode: 12 Links: 1
Access: (0777/-rwxrwxrwx) Uid: ( 2000/mattermost) Gid: ( 2000/mattermost)
Access: 2024-08-01 11:20:41.898364371 +0000
Modify: 2024-08-01 12:01:37.925276488 +0000
Change: 2024-08-01 15:03:10.272543753 +0000 admin@lab01:~/containers/mattermost$ docker exec -ti 3041657a2d9892f41f5083a2a5d6256af55615deba247b0a5cc9d60b25a8cc10 ls -l /tmp/mm-export-01-aug-2024
-rwxrwxrwx 1 mattermo mattermo 160957303 Aug 1 12:01 /tmp/mm-export-01-aug-2024 admin@lab01:~/containers/mattermost$ docker cp 3041657a2d9892f41f5083a2a5d6256af55615deba247b0a5cc9d60b25a8cc10:/tmp/mm-export-01-aug-2024 .
Error response from daemon: Could not find the file /tmp/mm-export-01-aug-2024 in container 3041657a2d9892f41f5083a2a5d6256af55615deba247b0a5cc9d60b25a8cc10
admin@lab01:~/containers/mattermost$
I am completely clueless what might be the issue. Copying the other way around works perfectly that is I could copy a file from the host into the container.
About the environment:
container runs as part of a docker compose setup
I’ve tried both docker cp and docker compose cp but to no avail
Client: Docker Engine - Community
Version: 27.0.3
API version: 1.46
Go version: go1.21.11
Git commit: 7d4bcd8
Built: Sat Jun 29 00:02:29 2024
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 27.0.3
API version: 1.46 (minimum version 1.24)
Go version: go1.21.11
Git commit: 662f78c
Built: Sat Jun 29 00:02:29 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.19
GitCommit: 2bf793ef6dc9a18e00cb12efb64355c2c9d5eb41
runc:
Version: 1.7.19
GitCommit: v1.1.13-0-g58aa920
docker-init:
Version: 0.19.0
GitCommit: de40ad0
I had the same problem but then realised the file in my container was on a volume.
I went into the container and copied it to another location and was then able to access it with docker cp.
I could obviously have just copied it from the volume instead.