docs icon indicating copy to clipboard operation
docs copied to clipboard

`docker cp -a` docs incorrect

Open cspotcode opened this issue 2 years ago • 19 comments

Is this a docs issue?

  • [X] My issue is about the documentation content or website

Type of issue

Information is incorrect

Description

Docs for docker cp -a claim that -a will "Archive mode (copy all uid/gid information)"

My testing shows that this is incorrect.

It appears that docker cp . container-name:/ without the -a flag will preserve ownership of the copied files. That is, a file owned by user ID 1234 on the host will be created with user ID 1234 within the container.

Adding the -a flag will instead change the ownership of copied files to match the --user of the container.

Location

https://docs.docker.com/engine/reference/commandline/cp/

Suggestion

No response

cspotcode avatar Jun 12 '23 21:06 cspotcode

  • I think this relates to a bug; see https://github.com/moby/moby/issues/34096

thaJeztah avatar Jun 12 '23 23:06 thaJeztah

A user would intuitively expect docker cp's --archive flag to enable something similar to Unix's cp -a but, in fact, it disables a behavior of cp -a.

What is the intended, bug-free behavior? Docker cp preserves everything except ownership, and -a enables ownership preservation? This means docker cp is not quite like unix cp nor cp -a

cspotcode avatar Jun 12 '23 23:06 cspotcode

There hasn't been any activity on this issue for a long time. If the problem is still relevant, mark the issue as fresh with a /remove-lifecycle stale comment. If not, this issue will be closed in 14 days. This helps our maintainers focus on the active issues.

Prevent issues from auto-closing with a /lifecycle frozen comment.

/lifecycle stale

docker-robot[bot] avatar Sep 10 '23 01:09 docker-robot[bot]

/remove-lifecycle stale

cspotcode avatar Sep 10 '23 01:09 cspotcode

There hasn't been any activity on this issue for a long time. If the problem is still relevant, mark the issue as fresh with a /remove-lifecycle stale comment. If not, this issue will be closed in 14 days. This helps our maintainers focus on the active issues.

Prevent issues from auto-closing with a /lifecycle frozen comment.

/lifecycle stale

docker-robot[bot] avatar Dec 09 '23 01:12 docker-robot[bot]

/remove-lifecycle stale

cspotcode avatar Dec 09 '23 01:12 cspotcode

There hasn't been any activity on this issue for a long time. If the problem is still relevant, mark the issue as fresh with a /remove-lifecycle stale comment. If not, this issue will be closed in 14 days. This helps our maintainers focus on the active issues.

Prevent issues from auto-closing with a /lifecycle frozen comment.

/lifecycle stale

docker-robot[bot] avatar Mar 15 '24 01:03 docker-robot[bot]

/remove-lifecycle stale

cspotcode avatar Mar 15 '24 01:03 cspotcode