Retry image creation after update not found
@@ -345,6 +345,7 @@ func (c *Client) Pull(ctx context.Context, ref string, opts ...RemoteOpt) (Image
}
is := c.ImageService()
+ for {
if created, err := is.Create(ctx, imgrec); err != nil {
if !errdefs.IsAlreadyExists(err) {
return nil, err
@@ -352,6 +353,10 @@ func (c *Client) Pull(ctx context.Context, ref string, opts ...RemoteOpt) (Image
updated, err := is.Update(ctx, imgrec)
if err != nil {
+ // if image was removed, try create again
+ if errdefs.IsNotFound(err) {
+ continue
+ }
return nil, err
}
@@ -359,6 +364,8 @@ func (c *Client) Pull(ctx context.Context, ref string, opts ...RemoteOpt) (Image
} else {
imgrec = created
}
+ break
+ }
img := &image{
client: c,
