mirror of
https://github.com/rancher/os.git
synced 2025-08-31 14:23:11 +00:00
Refactor to use libcompose
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
package docker
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
|
||||
dockerClient "github.com/fsouza/go-dockerclient"
|
||||
"github.com/rancherio/os/config"
|
||||
)
|
||||
@@ -28,25 +24,10 @@ func NewClient(endpoint string) (*dockerClient.Client, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
retry := false
|
||||
for i := 0; i < (MAX_WAIT / INTERVAL); i++ {
|
||||
_, err = client.Info()
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
err = ClientOK(endpoint, func() bool {
|
||||
_, err := client.Info()
|
||||
return err == nil
|
||||
})
|
||||
|
||||
retry = true
|
||||
|
||||
log.Infof("Waiting for Docker at %s", endpoint)
|
||||
time.Sleep(INTERVAL * time.Millisecond)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if retry {
|
||||
log.Infof("Connected to Docker at %s", endpoint)
|
||||
}
|
||||
return client, nil
|
||||
return client, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user