Skip to content

Commit

Permalink
fix: try pull image failure (#2061)
Browse files Browse the repository at this point in the history
Signed-off-by: 张启航 <[email protected]>
  • Loading branch information
ZhangSetSail authored Nov 20, 2024
1 parent 5d1113f commit 9716f17
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions builder/sources/image_containerd_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,17 @@ func (c *containerdImageCliImpl) ImagePull(image string, username, password stri
logrus.Errorf("HTTPS pull failed for image %s, trying HTTP", reference)
printLog(logger, "warn", fmt.Sprintf("HTTPS pull failed for image %s, trying HTTP", reference), map[string]string{"step": "pullimage"})
hostOpt.DefaultScheme = "http"
opts := []containerd.RemoteOpt{
containerd.WithImageHandler(h),
containerd.WithSchema1Conversion, //lint:ignore SA1019 nerdctl should support schema1 as well.
containerd.WithPlatformMatcher(platformMC),
}

options = docker.ResolverOptions{
Tracker: Tracker,
Hosts: config.ConfigureHosts(pctx, hostOpt),
}
opts = append(opts, containerd.WithResolver(docker.NewResolver(options)))
logrus.Infof("try again http")
img, err = c.client.Pull(pctx, reference, opts...)
}
Expand Down

0 comments on commit 9716f17

Please sign in to comment.