Skip to content

Commit

Permalink
Merge pull request #272 from tobiaszheller/feat/add-logging-on-image-…
Browse files Browse the repository at this point in the history
…pull-error

feat: add logging on image pull error
  • Loading branch information
gianarb authored Dec 24, 2020
2 parents 76be4c5 + 1ab2071 commit 5cce89b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@ import (
"time"

"github.com/cenkalti/backoff"
"github.com/docker/docker/errdefs"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/mount"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/client"
"github.com/docker/docker/errdefs"
"github.com/docker/go-connections/nat"

"github.com/google/uuid"
"github.com/pkg/errors"

Expand Down Expand Up @@ -403,7 +401,6 @@ func (c *DockerContainer) StartLogProducer(ctx context.Context) error {
})
}
}

}
}()

Expand All @@ -428,7 +425,6 @@ type DockerNetwork struct {

// Remove is used to remove the network. It is usually triggered by as defer function.
func (n *DockerNetwork) Remove(ctx context.Context) error {

return n.provider.client.NetworkRemove(ctx, n.ID)
}

Expand Down Expand Up @@ -695,10 +691,14 @@ func (p *DockerProvider) attemptToPullImage(ctx context.Context, tag string, pul
)
err = backoff.Retry(func() error {
pull, err = p.client.ImagePull(ctx, tag, pullOpt)
if _, ok := err.(errdefs.ErrNotFound); ok {
return backoff.Permanent(err)
if err != nil {
if _, ok := err.(errdefs.ErrNotFound); ok {
return backoff.Permanent(err)
}
log.Printf("Failed to pull image: %s, will retry", err)
return err
}
return err
return nil
}, backoff.WithContext(backoff.NewExponentialBackOff(), ctx))
if err != nil {
return err
Expand Down

0 comments on commit 5cce89b

Please sign in to comment.