From 60b0d08a6f9940ff6468e9104a59925cc6fd450a Mon Sep 17 00:00:00 2001 From: Lantao Liu Date: Wed, 23 May 2018 11:13:00 -0700 Subject: [PATCH] Use containerd.WithPullUnpack. Signed-off-by: Lantao Liu --- pkg/server/image_pull.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/pkg/server/image_pull.go b/pkg/server/image_pull.go index aea3db8c9..4db105e06 100644 --- a/pkg/server/image_pull.go +++ b/pkg/server/image_pull.go @@ -100,20 +100,14 @@ func (c *criService) PullImage(ctx context.Context, r *runtime.PullImageRequest) // image has already been converted. isSchema1 := desc.MediaType == containerdimages.MediaTypeDockerSchema1Manifest - // TODO(mikebrow): add truncIndex for image id image, err := c.client.Pull(ctx, ref, containerd.WithSchema1Conversion, containerd.WithResolver(resolver), + containerd.WithPullSnapshotter(c.config.ContainerdConfig.Snapshotter), + containerd.WithPullUnpack, ) if err != nil { - return nil, errors.Wrapf(err, "failed to pull image %q", ref) - } - - // Do best effort unpack. - logrus.Debugf("Unpack image %q", imageRef) - if err := image.Unpack(ctx, c.config.ContainerdConfig.Snapshotter); err != nil { - logrus.WithError(err).Warnf("Failed to unpack image %q", imageRef) - // Do not fail image pulling. Unpack will be retried before container creation. + return nil, errors.Wrapf(err, "failed to pull and unpack image %q", ref) } // Get image information.