{"record":{"id":"84dd0627dbe570c2","repo":"docker/cli","slug":"cannot-use-source-images-from-a-different-registry","errorCode":null,"errorMessage":"cannot use source images from a different registry than the target image: %s != %s","messagePattern":"cannot use source images from a different registry than the target image: (.+?) != (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/manifest/push.go","lineNumber":147,"sourceCode":"\t\t\timageManifest.Descriptor.Platform.Architecture == \"\" ||\n\t\t\timageManifest.Descriptor.Platform.OS == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"manifest %s must have an OS and Architecture to be pushed to a registry\", imageManifest.Ref)\n\t\t}\n\t\tdescriptor, err := buildManifestDescriptor(targetRepo, imageManifest)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdescriptors = append(descriptors, descriptor)\n\t}\n\n\treturn manifestlist.FromDescriptors(descriptors)\n}\n\nfunc buildManifestDescriptor(targetRepo reference.Named, imageManifest types.ImageManifest) (manifestlist.ManifestDescriptor, error) {\n\tmanifestRepoHostname := reference.Domain(reference.TrimNamed(imageManifest.Ref))\n\ttargetRepoHostname := reference.Domain(reference.TrimNamed(targetRepo))\n\tif manifestRepoHostname != targetRepoHostname {\n\t\treturn manifestlist.ManifestDescriptor{}, fmt.Errorf(\"cannot use source images from a different registry than the target image: %s != %s\", manifestRepoHostname, targetRepoHostname)\n\t}\n\n\tmanifest := manifestlist.ManifestDescriptor{\n\t\tDescriptor: distribution.Descriptor{\n\t\t\tDigest:    imageManifest.Descriptor.Digest,\n\t\t\tSize:      imageManifest.Descriptor.Size,\n\t\t\tMediaType: imageManifest.Descriptor.MediaType,\n\t\t},\n\t}\n\n\tplatform := types.PlatformSpecFromOCI(imageManifest.Descriptor.Platform)\n\tif platform != nil {\n\t\tmanifest.Platform = *platform\n\t}\n\n\tif err := manifest.Descriptor.Digest.Validate(); err != nil {\n\t\treturn manifestlist.ManifestDescriptor{}, fmt.Errorf(\"digest parse of image %q failed: %w\", imageManifest.Ref, err)\n\t}","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/command/manifest/push.go#L129-L165","documentation":"Returned by `buildManifestDescriptor` (push.go:144-148) when the source image's registry hostname differs from the target manifest-list hostname. The Docker manifest-list push only supports sources and targets within the same registry because blob mounting is registry-scoped.","triggerScenarios":"Running `docker manifest create registryA.com/mylist registryB.com/img:tag` then `docker manifest push registryA.com/mylist` — the registries differ.","commonSituations":"Aggregating images from multiple registries into one list, or mixing Docker Hub with a private registry.","solutions":["Use source images from the same registry hostname as the target list.","Copy/retag the source images into the target registry first (`docker pull`, `docker tag`, `docker push`).","Build a separate list per registry if multi-registry aggregation is needed.","Confirm hostnames exactly match, including default docker.io normalization."],"exampleFix":"# before\ndocker manifest create reg-a.com/mylist reg-b.com/img:tag\ndocker manifest push reg-a.com/mylist   # registries differ\n# after\ndocker pull reg-b.com/img:tag\ndocker tag reg-b.com/img:tag reg-a.com/img:tag\ndocker push reg-a.com/img:tag\ndocker manifest create reg-a.com/mylist reg-a.com/img:tag","handlingStrategy":"validation","validationCode":"targetHost := reference.Domain(reference.TrimNamed(targetRef))\nfor _, m := range manifests {\n    if reference.Domain(reference.TrimNamed(m.Ref)) != targetHost {\n        return fmt.Errorf(\"source %s is on a different registry than target %s; retag first\", m.Ref, targetRef)\n    }\n}","typeGuard":"func sameRegistry(a, b reference.Named) bool {\n    return reference.Domain(reference.TrimNamed(a)) == reference.Domain(reference.TrimNamed(b))\n}","tryCatchPattern":"if err := runPush(ctx, cli, opts); err != nil {\n    if strings.Contains(err.Error(), \"different registry than the target\") {\n        return fmt.Errorf(\"%w — retag sources into the target registry first\", err)\n    }\n    return err\n}","preventionTips":["Keep all source images in the same registry as the target list.","Retag and push sources into the target registry before creating the list.","Compare hostnames exactly, accounting for docker.io normalization."],"tags":["manifest","push","registry","cross-registry","validation","docker-cli"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}