aboutsummaryrefslogtreecommitdiff
path: root/libpod/image/pull.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/image/pull.go')
-rw-r--r--libpod/image/pull.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/libpod/image/pull.go b/libpod/image/pull.go
index 4240d72d8..1a77d89c8 100644
--- a/libpod/image/pull.go
+++ b/libpod/image/pull.go
@@ -201,6 +201,7 @@ func (ir *Runtime) pullGoalFromImageReference(ctx context.Context, srcRef types.
}
// pullImage pulls an image based on input name, which may involve from configured registries.
+// Use pullImageFromReference if the source is known precisely.
func (ir *Runtime) pullImage(ctx context.Context, inputName string, writer io.Writer, authfile, signaturePolicyPath string, signingOptions SigningOptions, dockerOptions *DockerRegistryOptions, forceSecure bool) ([]string, error) {
var goal pullGoal
sc := GetSystemContext(signaturePolicyPath, authfile, false)
@@ -220,6 +221,16 @@ func (ir *Runtime) pullImage(ctx context.Context, inputName string, writer io.Wr
return ir.doPullImage(ctx, sc, goal, writer, signingOptions, dockerOptions, forceSecure)
}
+// pullImageFromReference pulls an image from a types.imageReference.
+func (ir *Runtime) pullImageFromReference(ctx context.Context, srcRef types.ImageReference, writer io.Writer, authfile, signaturePolicyPath string, signingOptions SigningOptions, dockerOptions *DockerRegistryOptions, forceSecure bool) ([]string, error) {
+ sc := GetSystemContext(signaturePolicyPath, authfile, false)
+ goal, err := ir.pullGoalFromImageReference(ctx, srcRef, transports.ImageName(srcRef), sc)
+ if err != nil {
+ return nil, errors.Wrapf(err, "error determining pull goal for image %q", transports.ImageName(srcRef))
+ }
+ return ir.doPullImage(ctx, sc, goal, writer, signingOptions, dockerOptions, forceSecure)
+}
+
// doPullImage is an internal helper interpreting pullGoal. Almost everyone should call one of the callers of doPullImage instead.
func (ir *Runtime) doPullImage(ctx context.Context, sc *types.SystemContext, goal pullGoal, writer io.Writer, signingOptions SigningOptions, dockerOptions *DockerRegistryOptions, forceSecure bool) ([]string, error) {
policyContext, err := getPolicyContext(sc)