Skip to content

Commit b1d8698

Browse files
committed
print login failure reason to output
1 parent d4cf9f2 commit b1d8698

File tree

1 file changed

+30
-23
lines changed

1 file changed

+30
-23
lines changed

docker.go

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,26 @@ type (
3939

4040
// Build defines Docker build parameters.
4141
Build struct {
42-
Remote string // Git remote URL
43-
Name string // Docker build using default named tag
44-
Dockerfile string // Docker build Dockerfile
45-
Context string // Docker build context
46-
Tags []string // Docker build tags
47-
Args []string // Docker build args
48-
ArgsEnv []string // Docker build args from env
49-
Target string // Docker build target
50-
Squash bool // Docker build squash
51-
Pull bool // Docker build pull
52-
CacheFrom []string // Docker build cache-from
53-
Compress bool // Docker build compress
54-
Repo string // Docker build repository
55-
LabelSchema []string // label-schema Label map
56-
AutoLabel bool // auto-label bool
57-
Labels []string // Label map
58-
Link string // Git repo link
59-
NoCache bool // Docker build no-cache
60-
AddHost []string // Docker build add-host
61-
Quiet bool // Docker build quiet
42+
Remote string // Git remote URL
43+
Name string // Docker build using default named tag
44+
Dockerfile string // Docker build Dockerfile
45+
Context string // Docker build context
46+
Tags []string // Docker build tags
47+
Args []string // Docker build args
48+
ArgsEnv []string // Docker build args from env
49+
Target string // Docker build target
50+
Squash bool // Docker build squash
51+
Pull bool // Docker build pull
52+
CacheFrom []string // Docker build cache-from
53+
Compress bool // Docker build compress
54+
Repo string // Docker build repository
55+
LabelSchema []string // label-schema Label map
56+
AutoLabel bool // auto-label bool
57+
Labels []string // Label map
58+
Link string // Git repo link
59+
NoCache bool // Docker build no-cache
60+
AddHost []string // Docker build add-host
61+
Quiet bool // Docker build quiet
6262
}
6363

6464
// Plugin defines the Docker plugin parameters.
@@ -80,12 +80,16 @@ func (p Plugin) Exec() error {
8080

8181
// poll the docker daemon until it is started. This ensures the daemon is
8282
// ready to accept connections before we proceed.
83-
for i := 0; i < 15; i++ {
83+
for i := 0; ; i++ {
8484
cmd := commandInfo()
8585
err := cmd.Run()
8686
if err == nil {
8787
break
8888
}
89+
if i == 15 {
90+
fmt.Println("Unable to reach Docker Daemon after 15 attempts.")
91+
break
92+
}
8993
time.Sleep(time.Second * 1)
9094
}
9195

@@ -103,9 +107,12 @@ func (p Plugin) Exec() error {
103107
// login to the Docker registry
104108
if p.Login.Password != "" {
105109
cmd := commandLogin(p.Login)
106-
err := cmd.Run()
110+
raw, err := cmd.CombinedOutput()
107111
if err != nil {
108-
return fmt.Errorf("Error authenticating: %s", err)
112+
out := string(raw)
113+
out = strings.ReplaceAll(out, "WARNING! Using --password via the CLI is insecure. Use --password-stdin.", "")
114+
fmt.Println(out)
115+
return fmt.Errorf("Error authenticating: exit status 1")
109116
}
110117
}
111118

0 commit comments

Comments
 (0)