Skip to content

Commit

Permalink
Change ordering to handle docker-machine first (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmenglund authored and arekkas committed Feb 1, 2018
1 parent b01b564 commit 7b5419c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions dockertest.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,17 @@ func NewTLSPool(endpoint, certpath string) (*Pool, error) {
// TLS pools are automatically configured if the DOCKER_CERT_PATH environment variable exists.
func NewPool(endpoint string) (*Pool, error) {
if endpoint == "" {
if os.Getenv("DOCKER_HOST") != "" {
endpoint = os.Getenv("DOCKER_HOST")
} else if os.Getenv("DOCKER_URL") != "" {
endpoint = os.Getenv("DOCKER_URL")
} else if os.Getenv("DOCKER_MACHINE_NAME") != "" {
if os.Getenv("DOCKER_MACHINE_NAME") != "" {
client, err := dc.NewClientFromEnv()
if err != nil {
return nil, errors.Wrap(err, "")
return nil, errors.Wrap(err, "failed to create client from environment")
}

return &Pool{Client: client}, nil
} else if os.Getenv("DOCKER_HOST") != "" {
endpoint = os.Getenv("DOCKER_HOST")
} else if os.Getenv("DOCKER_URL") != "" {
endpoint = os.Getenv("DOCKER_URL")
} else if runtime.GOOS == "windows" {
endpoint = "http://localhost:2375"
} else {
Expand Down

0 comments on commit 7b5419c

Please sign in to comment.