You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today the daemon.Write interface just uses tarball.Write into the docker load interface. While correct, this can be incredibly slow for scenarios like ko -L because of its lack of incrementality.
In particular, for a large base image we produce and stream a fat tarball to the daemon for every publish. On top of this, since we don't have a local cache wrapping remote.Image, we download the base image every time. remote.Write elides both upload and download through the careful use of existence checks. We should be equally careful in daemon.Write.
One option to explore for this is what rules_docker did in its incremental load script. However, we should be careful to measure how this performs on a full daemon (we've seen superlinear behavior in some of the daemon calls before).
cc @dlorenc not sure if/what of your portfolio of tools might be using daemon.Write.
This would certainly be mitigated by the local caching we've been talking about, which feels relevant to kaniko + FROM caching, but ideally we'd just never access the content from layers present in the daemon.
I think that this could take advantage of the recently added l.(*remote.Layer) trick to direct the daemon to pull the image itself (vs. having us side-load it).
Then we'd want to add the capacity to omit layers from the tarball via a callback here.
This should avoid potential pathological behavior in the daemon, which I believe would otherwise require us to:
@jonjohnsonjr We also create a daemon image using the docker load interface.
However, we know that we are extending a base that already exists in the daemon and therefore we can do a hack. We discovered we could load a tarball that omits layer blobs, when a layer with the same chain ID already exists in the daemon. Therefore, when creating images we load tarballs with a manifest.json that look like this example:
This hack unfortunately can't be used to avoid reimporting layers to the daemon unless they appear in the exact same order as an existing image.
Yeah that's what rules_docker is doing here as well. I think it's actually a really common case during development, given that you're often re-loading the same base over and over again.
Looks like rules_docker does a linear probe of the daemon to determine what it already has -- I wonder if doing a binary search is faster, or if we expect so few layers to be shared that linear is better (since it guarantees only one miss).
This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.
Activity
mattmoor commentedon Jun 6, 2018
cc @dlorenc not sure if/what of your portfolio of tools might be using
daemon.Write.This would certainly be mitigated by the local caching we've been talking about, which feels relevant to kaniko +
FROMcaching, but ideally we'd just never access the content from layers present in the daemon.mattmoor commentedon Jun 10, 2018
I think that this could take advantage of the recently added
l.(*remote.Layer)trick to direct the daemon to pull the image itself (vs. having us side-load it).Then we'd want to add the capacity to omit layers from the tarball via a callback here.
This should avoid potential pathological behavior in the daemon, which I believe would otherwise require us to:
mattmoor commentedon Jun 10, 2018
Correction:
l.(*remote.MountableLayer). We would also have to generalize this to capture the fullname.Referenceinstead of just thename.Repository.Preserve the full source reference in MountableLayer
Add the option to exclude certain layers from the tarball.
Preserve the full source reference in MountableLayer (#208)
jonjohnsonjr commentedon Sep 12, 2019
cc @ekcasey is this similar to the hack you were describing? Or does imgutil do a different kind of incremental daemon loading?
ekcasey commentedon Sep 26, 2019
@jonjohnsonjr We also create a daemon image using the
docker loadinterface.However, we know that we are extending a base that already exists in the daemon and therefore we can do a hack. We discovered we could load a tarball that omits layer blobs, when a layer with the same chain ID already exists in the daemon. Therefore, when creating images we load tarballs with a
manifest.jsonthat look like this example:and only includes the additional layers. This significantly speeds things up but it isn't a general case solution.
This hack unfortunately can't be used to avoid reimporting layers to the daemon unless they appear in the exact same order as an existing image.
jonjohnsonjr commentedon Sep 26, 2019
Yeah that's what rules_docker is doing here as well. I think it's actually a really common case during development, given that you're often re-loading the same base over and over again.
jonjohnsonjr commentedon Oct 3, 2019
Looks like rules_docker does a linear probe of the daemon to determine what it already has -- I wonder if doing a binary search is faster, or if we expect so few layers to be shared that linear is better (since it guarantees only one miss).
Add option to filter layers from tarball
Add option to filter layers from tarball
Add option to filter layers from tarball
github-actions commentedon Oct 27, 2020
This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with
/reopen. Mark the issue asfresh by adding the comment
/remove-lifecycle stale.