Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I copy from a tar file stream #2322

Open
zuzuviewer opened this issue Mar 1, 2024 · 6 comments
Open

How can I copy from a tar file stream #2322

zuzuviewer opened this issue Mar 1, 2024 · 6 comments

Comments

@zuzuviewer
Copy link

How can I copy image from a tar file stream not a tar file.
My server have a image upload api use multipart/form, it receive a docker image tar file stream, now I must create a temp file to save image and then copy it to backend repository, how can I directly copy upload stream to backend repository

@mtrmac
Copy link
Collaborator

mtrmac commented Mar 1, 2024

Thanks for reaching out.

Please be more specific about what you are trying to do. Steps to reproduce / actual results / expected results?

If this is about the docker-archive: transport, consuming that inherently requires random access (or, equivalently, extracting the archive to a filesystem, and then accessing files in random order), so some kind of staging mechanism is inevitable.

@zuzuviewer
Copy link
Author

now:

  1. upload a docker archive file by api to my server
  2. write this docker archive stream in a temp file.
  3. copy this temp file to docker repository by docker-archive transport.

expect:

  1. upload a docker archive file by api to my server
  2. copy this docker archive stream to docker repository.

I want to copy stream to docker repository directly otherwise write stream to temp file, then copy from this temp file. Because temp file will use operate system buffer/cache

@mtrmac
Copy link
Collaborator

mtrmac commented Mar 5, 2024

As already described above, that’s just not possible. You can provide a stream to docker-archive (using a named pipe, or perhaps /dev/fd/…), but docker-archive: is going to create that temporary file internally.

In general, I would recommend not building any workflows around the docker-archive: format in the first place; use a registry. I realize that’s not always possible or trivial to change, but it is a better design, eliminating this performance issue, for example.

@zuzuviewer
Copy link
Author

Thanks your advice. What do you mean ‘use a registry’?

1 similar comment
@zuzuviewer
Copy link
Author

Thanks your advice. What do you mean ‘use a registry’?

@mtrmac
Copy link
Collaborator

mtrmac commented Mar 8, 2024

https://github.com/opencontainers/distribution-spec/, e.g. https://github.com/distribution/distribution .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants