Skip to content

docker cp is not setting the right UID & GID to the destination file #1814

@rbelouin

Description

@rbelouin

Expected behavior

According to the documentation, I expect the destination file to have root:root as an owner.

Actual behavior

The destination file is set with 501:dialout as an owner. 501 is the UID of my local user, the one actually invoking docker cp.

Information

Diagnostic ID: 2641786D-4283-438C-A772-0741838174DE

Unfortunately, I'm not sure whether I am allowed to share the Dockerfile publicly.

Steps to reproduce the behavior

[rbelouin dev(authorized-keys-owner)]% echo $UID $GID
501 20
[rbelouin dev(authorized-keys-owner)]% echo plop > plop.txt
[rbelouin dev(authorized-keys-owner*)]% docker cp plop.txt $(docker-compose ps -q website):/root/plop.txt
[rbelouin dev(authorized-keys-owner*)]% docker-compose exec website bash
root@4a53e665800d:~# ls -l
total 8
drwxr-xr-x 2 root root    4096 Apr 27 21:23 keys
-rw-r--r-- 1  501 dialout    5 Jul  3 11:18 plop.txt
root@4a53e665800d:~#

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions