Skip to content

Commit

Permalink
debugging: for auth errors
Browse files Browse the repository at this point in the history
Add debugging to help identify why we get no auth.
  • Loading branch information
stevenh committed Aug 19, 2024
1 parent 657e42c commit 931b868
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (

"github.com/cenkalti/backoff/v4"
"github.com/containerd/platforms"
"github.com/cpuguy83/dockercfg"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
Expand Down Expand Up @@ -1321,7 +1322,17 @@ func (p *DockerProvider) ReuseOrCreateContainer(ctx context.Context, req Contain
func (p *DockerProvider) attemptToPullImage(ctx context.Context, tag string, pullOpt image.PullOptions) error {
registry, imageAuth, err := DockerImageAuth(ctx, tag)
if err != nil {
p.Logger.Printf("Failed to get image auth for %s. Setting empty credentials for the image: %s. Error is: %s", registry, tag, err)
cfg, errc := getDockerConfig()
path, errp := dockercfg.UserHomeConfigPath()
p.Logger.Printf("DOCKER_AUTH_CONFIG: %q DOCKER_CONFIG: %q path: %q, config: %#v errc: %v errp: %v",
os.Getenv("DOCKER_AUTH_CONFIG"),
os.Getenv("DOCKER_CONFIG"),
path,
cfg,
errc,
errp,
)
p.Logger.Printf("Failed to get image auth for %s. Setting empty credentials for the image: %s. Error is: %s Config: %#v", registry, tag, err)
} else {
// see https://github.com/docker/docs/blob/e8e1204f914767128814dca0ea008644709c117f/engine/api/sdk/examples.md?plain=1#L649-L657
encodedJSON, err := json.Marshal(imageAuth)
Expand Down

0 comments on commit 931b868

Please sign in to comment.