make weave and the proxy work with tcp-only dockers via DOCKER_HOST

This commit is contained in:
Paul Bellamy authored and Bryan Boreham committed 2015-12-15 18:02:59 +00:00
1 parent 0afc3db383
commit f28ad350bd
3 files changed
+27 -5

No files matched your search

+8
View File
@@ -2,6 +2,8 @@ package docker
import (
"errors"
"strings"
"github.com/fsouza/go-dockerclient"
. "github.com/weaveworks/weave/common"
@@ -19,6 +21,9 @@ type Client struct {
// NewClient creates a new Docker client and checks we can talk to Docker
func NewClient(apiPath string) (*Client, error) {
if apiPath != "" && !strings.Contains(apiPath, "://") {
apiPath = "tcp://" + apiPath
}
dc, err := docker.NewClient(apiPath)
if err != nil {
return nil, err
@@ -29,6 +34,9 @@ func NewClient(apiPath string) (*Client, error) {
}
func NewVersionedClient(apiPath string, apiVersionString string) (*Client, error) {
if !strings.Contains(apiPath, "://") {
apiPath = "tcp://" + apiPath
}
dc, err := docker.NewVersionedClient(apiPath, apiVersionString)
if err != nil {
return nil, err