Skip to content

Docker cp success message shows wrong size #5777

@liefke

Description

@liefke

Description

As described in https://stackoverflow.com/questions/79394678/why-is-the-size-in-the-success-message-of-docker-cp-wrong the success message of docker cp doesn't tell the real size of the transferred file, but the size of the transferred tarball. As the user usually isn't aware of the implementation, the given size sends the user on the wrong track.

Reproduce

Run docker cp with a file that has a well known size and check the result message:

docker cp empty-file my-container:/empty-file
Successfully copied 1.54kB to ...

Observed behavior: The size in the result message is always greater than the size of the copied file.

Expected behavior

The result message should either show the correct size, should describe why the size is greater (Successfully copied a tarball of 1.54kB to ...), or should not contain the size at all.

docker version

Client: Docker Engine - Community
 Version:           27.5.1
 API version:       1.47
 Go version:        go1.22.11
 Git commit:        9f9e405
 Built:             Wed Jan 22 13:42:47 2025
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          27.5.1
  API version:      1.47 (minimum version 1.24)
  Go version:       go1.22.11
  Git commit:       4c9b3b0
  Built:            Wed Jan 22 13:41:09 2025
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.7.25
  GitCommit:        bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
 runc:
  Version:          1.2.4
  GitCommit:        v1.2.4-0-g6c52b3f
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Client: Docker Engine - Community
 Version:    27.5.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.20.0
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.32.4
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Additional Info

No response

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