diff --git a/docker/docker_image_dest.go b/docker/docker_image_dest.go index 979100ee38..7ddea2c098 100644 --- a/docker/docker_image_dest.go +++ b/docker/docker_image_dest.go @@ -30,8 +30,10 @@ import ( ) type dockerImageDestination struct { - ref dockerReference - c *dockerClient + ref dockerReference + c *dockerClient + acceptUncompressedLayers bool + // State manifestDigest digest.Digest // or "" if not yet known. } @@ -42,10 +44,16 @@ func newImageDestination(sys *types.SystemContext, ref dockerReference) (types.I if err != nil { return nil, err } - return &dockerImageDestination{ + d := &dockerImageDestination{ ref: ref, c: c, - }, nil + } + + if sys != nil { + d.acceptUncompressedLayers = sys.DockerAcceptUncompressedLayers + } + + return d, nil } // Reference returns the reference used to set up this destination. Note that this should directly correspond to user's intent, @@ -89,6 +97,9 @@ func (d *dockerImageDestination) SupportsSignatures(ctx context.Context) error { } func (d *dockerImageDestination) DesiredLayerCompression() types.LayerCompression { + if d.acceptUncompressedLayers { + return types.PreserveOriginal + } return types.Compress } diff --git a/types/types.go b/types/types.go index d469e03b53..e1a7f4e7dc 100644 --- a/types/types.go +++ b/types/types.go @@ -566,6 +566,10 @@ type SystemContext struct { DockerDisableV1Ping bool // If true, dockerImageDestination.SupportedManifestMIMETypes will omit the Schema1 media types from the supported list DockerDisableDestSchema1MIMETypes bool + // Allow uncompressed image layers in Docker images + DockerAcceptUncompressedLayers bool + + // === ostree.Transport overrides === // Directory to use for OSTree temporary files OSTreeTmpDirPath string