summaryrefslogtreecommitdiff
path: root/libpod/image
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/image')
-rw-r--r--libpod/image/docker_registry_options.go3
-rw-r--r--libpod/image/image.go7
-rw-r--r--libpod/image/pull.go2
3 files changed, 11 insertions, 1 deletions
diff --git a/libpod/image/docker_registry_options.go b/libpod/image/docker_registry_options.go
index c434f0259..257b7ae8d 100644
--- a/libpod/image/docker_registry_options.go
+++ b/libpod/image/docker_registry_options.go
@@ -30,6 +30,8 @@ type DockerRegistryOptions struct {
OSChoice string
// If not "", overrides the use of platform.GOARCH when choosing an image or verifying architecture match.
ArchitectureChoice string
+ // If not "", overrides_VARIANT_ instead of the running architecture variant for choosing images.
+ VariantChoice string
// RegistriesConfPath can be used to override the default path of registries.conf.
RegistriesConfPath string
}
@@ -43,6 +45,7 @@ func (o DockerRegistryOptions) GetSystemContext(parent *types.SystemContext, add
DockerArchiveAdditionalTags: additionalDockerArchiveTags,
OSChoice: o.OSChoice,
ArchitectureChoice: o.ArchitectureChoice,
+ VariantChoice: o.VariantChoice,
BigFilesTemporaryDir: parse.GetTempDir(),
}
if parent != nil {
diff --git a/libpod/image/image.go b/libpod/image/image.go
index 6106084d5..dee2ce0ee 100644
--- a/libpod/image/image.go
+++ b/libpod/image/image.go
@@ -1246,7 +1246,12 @@ func areParentAndChild(parent, child *imgspecv1.Image) bool {
// the child and candidate parent should share all of the
// candidate parent's diff IDs, which together would have
// controlled which layers were used
- if len(parent.RootFS.DiffIDs) > len(child.RootFS.DiffIDs) {
+
+ // issue #7444 describes a panic where the length of child.RootFS.DiffIDs
+ // is checked but child is nil. Adding a simple band-aid approach to prevent
+ // the problem until the origin of the problem can be worked out in the issue
+ // itself.
+ if child == nil || len(parent.RootFS.DiffIDs) > len(child.RootFS.DiffIDs) {
return false
}
childUsesCandidateDiffs := true
diff --git a/libpod/image/pull.go b/libpod/image/pull.go
index 641698d03..bdcda4016 100644
--- a/libpod/image/pull.go
+++ b/libpod/image/pull.go
@@ -228,6 +228,7 @@ func (ir *Runtime) pullImageFromHeuristicSource(ctx context.Context, inputName s
if dockerOptions != nil {
sc.OSChoice = dockerOptions.OSChoice
sc.ArchitectureChoice = dockerOptions.ArchitectureChoice
+ sc.VariantChoice = dockerOptions.VariantChoice
}
sc.BlobInfoCacheDir = filepath.Join(ir.store.GraphRoot(), "cache")
srcRef, err := alltransports.ParseImageName(inputName)
@@ -260,6 +261,7 @@ func (ir *Runtime) pullImageFromReference(ctx context.Context, srcRef types.Imag
if dockerOptions != nil {
sc.OSChoice = dockerOptions.OSChoice
sc.ArchitectureChoice = dockerOptions.ArchitectureChoice
+ sc.VariantChoice = dockerOptions.VariantChoice
}
goal, err := ir.pullGoalFromImageReference(ctx, srcRef, transports.ImageName(srcRef), sc)
if err != nil {