docker cp: report both content size and transferred size#6802
Draft
thaJeztah wants to merge 1 commit intodocker:masterfrom
Draft
docker cp: report both content size and transferred size#6802thaJeztah wants to merge 1 commit intodocker:masterfrom
thaJeztah wants to merge 1 commit intodocker:masterfrom
Conversation
5 tasks
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
When copying files to a container, the `docker cp` command would print
a message reporting the size of files copied. However, this size was
based on the size of the TAR stream sent, which includes the size of
the TAR headers.
docker container create --name my-container busybox
touch empty-file
docker cp empty-file my-container:/empty-file
Successfully copied 1.54kB to my-container:/empty-file
This patch adds a `calcTARContentSize` utility, which uses the
TAR headers to calculate the size of files included.
With this patch applied, the content size is reported, instead
of the size of the TAR stream used for transport;
docker container create --name my-container busybox
touch empty-file
docker cp empty-file my-container:/empty-file
Successfully copied 0B (transferred 1.54kB) to my-container:/empty-file
mkdir empty-dir
docker cp ./empty-dir my-container:/somewhere/
Successfully copied 0B (transferred 1.54kB) to my-container:/somewhere/
docker cp ./cli/command my-container:/files/
Successfully copied 2.01MB (transferred 2.53MB) to my-container:/files/
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
c27e26f to
5a112d8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When copying files to a container, the
docker cpcommand would print a message reporting the size of files copied. However, this size was based on the size of the TAR stream sent, which includes the size of the TAR headers.This patch adds a
calcTARContentSizeutility, which uses the TAR headers to calculate the size of files included.With this patch applied, the content size is reported, instead of the size of the TAR stream used for transport;
- What I did
- How I did it
- How to verify it
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)