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

Question about updating image #21

Open
volezheng opened this issue Aug 11, 2023 · 3 comments
Open

Question about updating image #21

volezheng opened this issue Aug 11, 2023 · 3 comments

Comments

@volezheng
Copy link

Hi, I'm looking for an approach to push images to remote. Currently I'm using docker save and load, which need to transfer the full image each time which is inefficient. Usually I only update one layer.

I haven't tried this, but I looked at the code. It seems it launches a temp registry each time and shut it down after transfering. My question is when updating image, a new temp registry is launched, could it reuse the old data in the previous one, so that it does not need to transfer the whole image each time? Thanks for answering.

@brthor
Copy link
Owner

brthor commented Aug 23, 2023

It's been a while since I've looked at this code, but with a brief look, it appears that the answer is yes.

https://github.com/brthor/docker-push-ssh/blob/master/docker_push_ssh/cli.py#L61C1-L62C96

When the registry is launched, it mounts some directory on the host and I think that's doing what you're asking, but you should test it.

Note that testing it out may require some modernization of the code. IIRC this was written in python2.

I used https://github.com/brthor/docker-save-last-layer for a similar use case.

@volezheng
Copy link
Author

Thanks for the pointer! It's a very interesting idea!

Which one do you think is a better solution? If the registry could reuse old data, it seems this one is more systematic, since it's a real registry.
The last-layer solution seems a pretty specific one, and when more than one layer is updated, it does not work (maybe with some more hack, it could support #layers specified by user, but we still need to diff the image to see how many layers are changed).

@brthor
Copy link
Owner

brthor commented Nov 29, 2023

The purpose of the save last layer repo was to squash all the changed layers into one, and export only that.

Using the registry is likely the more general case solution.

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