newImageDestination creates a new ImageDestination for the specified image reference.
(sys *types.SystemContext, ref dockerReference)
| 52 | |
| 53 | // newImageDestination creates a new ImageDestination for the specified image reference. |
| 54 | func newImageDestination(sys *types.SystemContext, ref dockerReference) (private.ImageDestination, error) { |
| 55 | registryConfig, err := loadRegistryConfiguration(sys) |
| 56 | if err != nil { |
| 57 | return nil, err |
| 58 | } |
| 59 | c, err := newDockerClientFromRef(sys, ref, registryConfig, true, "pull,push") |
| 60 | if err != nil { |
| 61 | return nil, err |
| 62 | } |
| 63 | mimeTypes := []string{ |
| 64 | imgspecv1.MediaTypeImageManifest, |
| 65 | manifest.DockerV2Schema2MediaType, |
| 66 | imgspecv1.MediaTypeImageIndex, |
| 67 | manifest.DockerV2ListMediaType, |
| 68 | } |
| 69 | if c.sys == nil || !c.sys.DockerDisableDestSchema1MIMETypes { |
| 70 | mimeTypes = append(mimeTypes, manifest.DockerV2Schema1SignedMediaType, manifest.DockerV2Schema1MediaType) |
| 71 | } |
| 72 | |
| 73 | dest := &dockerImageDestination{ |
| 74 | PropertyMethodsInitialize: impl.PropertyMethods(impl.Properties{ |
| 75 | SupportedManifestMIMETypes: mimeTypes, |
| 76 | DesiredLayerCompression: types.Compress, |
| 77 | MustMatchRuntimeOS: false, |
| 78 | IgnoresEmbeddedDockerReference: false, // We do want the manifest updated; older registry versions refuse manifests if the embedded reference does not match. |
| 79 | HasThreadSafePutBlob: true, |
| 80 | }), |
| 81 | NoPutBlobPartialInitialize: stubs.NoPutBlobPartial(ref), |
| 82 | |
| 83 | ref: ref, |
| 84 | c: c, |
| 85 | } |
| 86 | dest.Compat = impl.AddCompat(dest) |
| 87 | return dest, nil |
| 88 | } |
| 89 | |
| 90 | // Reference returns the reference used to set up this destination. Note that this should directly correspond to user's intent, |
| 91 | // e.g. it should use the public hostname instead of the result of resolving CNAMEs or following redirects. |
nothing calls this directly
no test coverage detected
searching dependent graphs…