Feature request: docker save layer / docker load layer for exporting/importing individual image layers
Tell us about your request
Introduce commands such as docker save layer and docker load layer to export and import individual image layers. This would allow transferring only the modified layers between systems instead of full images.
Which service(s) is this request for? Docker Engine / Docker CLI (image distribution and management).
Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard? We maintain servers where Docker images need to be updated.
On online servers connected to our private registry, only new layers are pulled — which is efficient.
But for completely offline servers, the only option today is docker save + docker load, which exports/imports the entire image tarball (tens of gigabytes).
This is highly inefficient when only a few megabytes of new layers are needed.
Are you currently working around the issue? Currently, we:
- Use
docker saveto export the entire image. - Transfer the full tarball to the offline server.
- Run
docker load.
This works but is wasteful. Even if only one layer changes, we still have to move the entire image. However, our servers are sometimes located in very remote areas with very low bandwidth. A 20 GB transfer takes hours.
Additional context A new pair of commands could look like this:
Export only the new/modified layers since last image
docker save layer ba62abf05066857cf541f1dc583924d629fd56e01a706a1fad5278a792d49301 \
-o layer_update.tar
Import those layers on the offline server
docker load layer -i layers_update.tar
And if a layer needs to be deleted:
docker prune layer 7ac0de10b3610c288e1a3249b0d694f573c33de6a93d8e63d6ddbdcab2e0c0fb
Optionally, docker load layer could also prune removed layers to keep the image store clean.
Here’s an example of how we already track changed layers between builds with a registry:
"added_layers": [
"sha256:ba62abf05066857cf541f1dc583924d629fd56e01a706a1fad5278a792d49301"
],
"removed_layers": [
"sha256:7ac0de10b3610c288e1a3249b0d694f573c33de6a93d8e63d6ddbdcab2e0c0fb"
]
With docker save layer / docker load layer, offline updates could shrink from ~20GB down to ~20MB, making them practical.
Is there anything on the roadmap that would allow such granular export/import of layers?
Thanks for considering this, and for all the amazing work on Docker!
+1
+1