-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Podman can't load some tars that docker can. #8132
Comments
@mtrmac PTAL |
At least reading https://github.com/moby/moby/blob/master/image/spec/v1.2.md , I can’t see anything to suggest that Looking at the bottom layer It’s just not valid to drop 73 MB of data from an image and expect it to load. And, actually, Docker doesn't: $ docker load < …/api_load.tar799613769
ccf04fbd6e19: Loading layer [> ] 0 B/4.096 kB
read /var/lib/docker/tmp/docker-import-887967241: is a directory Apparently someone figured out that the Docker implementation mostly ignores the file paths if the layers are already present on the local machine, so it is possible to create archives that only contain the top layers if the destination already contains the parent layers. I guess congratulations for being clever, but that’s never been valid in the format or supported in any sense, as the unhelpful error message above suggests. The c/image implementation works differently, and to generate a consistent internal representation, it needs to compute the sizes of all layers, and that’s impossible if most layers are just plain missing. A “simple” fix is to use full But I’d strongly recommend to use an actual registry (even if running only shortly, in a container, with a volume mounted as the backing storage, once to copy the image into the registry and once to copy it out); a registry has automatic fully supported deduplication, copying images from/to registries does not create multiple on-disk copies of the uncompressed data just to make a copy. It’s a much more efficient way to transfer images. |
@mtrmac thanks for looking into this. Looks like the |
To make Podman accept this kind of delta archive with missing layers, the Get
Edit
and add the new file along with the dummy ones:
Note that this only concerns the default Tested on Podman 3.3.0. |
@vlk-charles thanks a lot! I'll try that tomorrow. |
Let me be very clear that this is not a maintained behavior. If it works for you, great; if it breaks for any reason at all (a specific work to enable a new feature, a bug, a refactoring for purely aesthetically reasons), I’m not promising to do anything to make it work again; possibly including not accepting PRs that fix it, unless they make the rest of the code better regardless of this use case. My recommendation continues to be to use a registry, which automatically provides cross-image deduplication, parallel operation, and higher performance in general. |
This definitely is unsupported behavior. I could have stressed that. If a PR were to change the behavior to accept archives with missing layers and issue a warning in such case (or error if not already present on local machine), would that be acceptable? I'm not saying I will implement it, just curious. |
I think you’ll find that it’s not easily possible — we didn’t take an extra effort to refuse such archives, they are refused because the current implementation approach (generating an in-memory schema2 manifest) requires knowing sizes of layers, and that requires reading the layers. This is kind of what I was hinting at – a PR that would add special carve-outs for the generic schema2 formats to make this invalid format work is IMHO not worth it. [It would conceptually be interesting to rework this so that the docker-archive manifest format is natively supported in the core codebase, without the schema2 intermediate steps, and that might avoid the need to know the size; but it’s also quite a bit of work and churn, even just reviewing the PRs.] To clarify a bit, I am interested in the use case. There might well be some improvement that we should do; e.g. containers/skopeo#1440 discusses some non-registry format. Right now it doesn’t seem urgent but that might be just me not knowing something. But I’m very skeptical that |
One tool I use (
pack
) seems to produce tar files that are accepted bydocker load < a.tar
, butpodman load < a.tar
fails with message:The thing is the archive manifest.json contains "empty layers",
The config contain expected count of
diff_ids
.The error seems to came from validation in
github.com/containers/image/v5/docker/internal/tarfile/src.go
There is another odd thing about the archive, some items in it seems to have absolute path, which may cause problem to
arch
linux util, but I don't think it's causing troubles topodman
.I am not sure if this is bug, or
docker
is really permissive.The text was updated successfully, but these errors were encountered: