mirror of
https://github.com/bcicen/ctop.git
synced 2025-12-06 15:16:41 +08:00
get dockerhost from environment
This commit is contained in:
7
main.go
7
main.go
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user