Skip to content

Commit 7b5419c

Browse files
pmenglundarekkas
authored andcommitted
Change ordering to handle docker-machine first (#109)
1 parent b01b564 commit 7b5419c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

dockertest.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,17 @@ func NewTLSPool(endpoint, certpath string) (*Pool, error) {
8383
// TLS pools are automatically configured if the DOCKER_CERT_PATH environment variable exists.
8484
func NewPool(endpoint string) (*Pool, error) {
8585
if endpoint == "" {
86-
if os.Getenv("DOCKER_HOST") != "" {
87-
endpoint = os.Getenv("DOCKER_HOST")
88-
} else if os.Getenv("DOCKER_URL") != "" {
89-
endpoint = os.Getenv("DOCKER_URL")
90-
} else if os.Getenv("DOCKER_MACHINE_NAME") != "" {
86+
if os.Getenv("DOCKER_MACHINE_NAME") != "" {
9187
client, err := dc.NewClientFromEnv()
9288
if err != nil {
93-
return nil, errors.Wrap(err, "")
89+
return nil, errors.Wrap(err, "failed to create client from environment")
9490
}
9591

9692
return &Pool{Client: client}, nil
93+
} else if os.Getenv("DOCKER_HOST") != "" {
94+
endpoint = os.Getenv("DOCKER_HOST")
95+
} else if os.Getenv("DOCKER_URL") != "" {
96+
endpoint = os.Getenv("DOCKER_URL")
9797
} else if runtime.GOOS == "windows" {
9898
endpoint = "http://localhost:2375"
9999
} else {

0 commit comments

Comments
 (0)