docker-push-ssh
docker-push-ssh copied to clipboard
Question about updating image
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.
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.
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).
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.