简体   繁体   中英

How docker load a diff image

I know docker save can save a image to tar and use docker load to reload a image.

For example:

I have a Machine A and B. B can't connect hub . A is image:latest and B is image:base.

I have to save multi image in A as some tar file , but the tar files are too big to transfer.

Can I save the diff between tags or image ids in A and load the diff in B?

Not save the whole image which help update patch much more smaller.

This isn't possible using standard Docker tooling. The only option docker save takes is an option to write to a file rather than to stdout, and it always contains all parent layers (and base images).

If your only problem is transferring the images, consider either techniques to reduce the image size (for example, use a multi-stage image to not include build-time dependencies in the final image) or using tools like split (1) to break the tar file into smaller parts.

I believe the docker save tar file output is the same as the "Export an image" API call . It might be possible to manually edit that tar file to delete layers, and there might be tools out there that do this. (This is not a particularly mainstream path, though; I've looked into it several years ago but not done it myself, and occasionally see tools mentioned in infrequent SO answers.)

In between the standard behavior of docker pull and docker save only creating complete image chains, in principle there's no way to set up Docker so that you never only have the "top half" of an image but not the base layers below this. Editing the docker save tar files by hand would violate this invariant.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM