Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,21 @@ func (p Plugin) Exec() error {
if maxRetries <= 0 {
maxRetries = 15 // default value
}
// If the daemon still isn't reachable after max retries, fail fast.
//
// Historically this code only printed an error and continued, which led to
// confusing follow-up failures like:
// "Cannot connect to the Docker daemon at unix:///var/run/docker.sock"
//
// See: https://github.com/drone-plugins/drone-docker/issues/414
for i := 0; ; i++ {
cmd := commandInfo()
err := cmd.Run()
if err == nil {
break
}
if i == maxRetries {
fmt.Printf("Unable to reach Docker Daemon after %d attempts.\n", maxRetries)
break
return fmt.Errorf("unable to reach Docker Daemon after %d attempts", maxRetries)
}
time.Sleep(time.Second * 1)
}
Expand Down