Skip to content

Commit 941d73c

Browse files
authored
Improve error message if failed to pull manager image in CLI (#1725)
1 parent 00a263d commit 941d73c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

cli/cmd/lib_manager.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ func runManager(containerConfig *container.Config, addNewLineAfterPull bool, cop
6363

6464
pulledImage, err := docker.PullImage(containerConfig.Image, docker.NoAuth, docker.PrintDots)
6565
if err != nil {
66+
if strings.Contains(err.Error(), "auth") {
67+
err = errors.Append(err, fmt.Sprintf("\n\nif your manager image is stored in a private repository: run `docker login` (if you haven't already), download your image with `docker pull %s`, and try this command again)", containerConfig.Image))
68+
}
6669
return "", nil, err
6770
}
6871

pkg/lib/docker/errors.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ func ErrorImageInaccessible(image string, providerType types.ProviderType, cause
7676
switch providerType {
7777
case types.LocalProviderType:
7878
message += fmt.Sprintf("\n\nyou can download your image with `docker pull %s` and try this command again", image)
79-
if strings.Contains(cause.Error(), "authorized") || strings.Contains(cause.Error(), "authentication") {
79+
if strings.Contains(cause.Error(), "auth") {
8080
message += " (if your registry is private, run `docker login` first)"
8181
}
8282
case types.AWSProviderType:
83-
if strings.Contains(cause.Error(), "authorized") || strings.Contains(cause.Error(), "authentication") {
83+
if strings.Contains(cause.Error(), "auth") {
8484
message += fmt.Sprintf("\n\nif you would like to use a private docker registry, see https://docs.cortex.dev/v/%s/", consts.CortexVersionMinor)
8585
}
8686
}

0 commit comments

Comments
 (0)