get dockerhost from environment

This commit is contained in:
Bradley Cicenas 2016-12-25 19:07:42 +00:00
parent ca9ea17a81
commit a15d4c4dfe
1 changed files with 6 additions and 1 deletions

View File

@ -13,7 +13,12 @@ func main() {
os.Exit(1)
}
client, err := docker.NewClient("tcp://127.0.0.1:4243")
dockerhost := os.Getenv("DOCKER_HOST")
if dockerhost == "" {
dockerhost = "unix:///var/run/docker.sock"
}
client, err := docker.NewClient(dockerhost)
if err != nil {
panic(err)
}