Open jonjohnsonjr opened 5 years ago
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
.
The
tarball
package has methods for reading/writing images from/to thedocker save
tarball format. This aligns with how the other packages are organized, for example:remote
is for reading/writing from/to registries.daemon
is for reading/writing from/to container daemons.layout
is for reading/writing from/to OCI image layouts.However, the
tarball
package also has methods for constructingv1.Layer
s from a file or from anOpener
. It kind of makes sense to be in thetarball
package because the layers happen to be compressed tarballs, but really that's an implementation detail. These functions aren't for tarball-specific layers, they're just for layers in general.We should try to replace these with
stream.Layer
wherever we can. Thetarball.Layer
currently reads the whole tarball twice because it eagerly computes the digest/size/diffid. For uncompressed layers,stream.Layer
is just better.For compressed layers, we usually have some metadata that makes eagerly computing those things unnecessary (e.g.
remoteLayer
). For reading compressed layer from atarball.Image
, we should know the diffids from the config file.tl;dr
LayerFromOpener
is bad, let's makestream.Layer
work. I elaborated on this a bit here.