Skip to content

Commit

Permalink
cmd/create: Mention that private images require 'podman login'
Browse files Browse the repository at this point in the history
It's not possible to programmatically detect when an image requires
logging into the registry [1]. Therefore, instead of trying to handle
'podman pull' failures due to lack of authorization, just mention that
private images require 'podman login' and that further details of the
failure can be found by using the --verbose option.

[1] containers/podman#10858

containers#754
containers#852
  • Loading branch information
debarshiray committed Jul 23, 2021
1 parent f761791 commit 6672aa7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,13 @@ func pullImage(image, release string) (bool, error) {
}

if err := podman.Pull(imageFull); err != nil {
return false, fmt.Errorf("failed to pull image %s", imageFull)
var builder strings.Builder
fmt.Fprintf(&builder, "failed to pull image %s\n", imageFull)
fmt.Fprintf(&builder, "If it was a private image, log in with: podman login %s\n", domain)
fmt.Fprintf(&builder, "Use '%s --verbose ...' for further details.", executableBase)

errMsg := builder.String()
return false, errors.New(errMsg)
}

return true, nil
Expand Down

0 comments on commit 6672aa7

Please sign in to comment.