From 6302dc553c1c627d9ec765ec30e3e9f1d6a0f8dc Mon Sep 17 00:00:00 2001 From: Evan Phoenix Date: Tue, 7 Apr 2015 09:24:16 -0700 Subject: [PATCH] Detect docker is not available gracefully --- plugins/system/system.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/system/system.go b/plugins/system/system.go index a8eb6669d..c01aa4500 100644 --- a/plugins/system/system.go +++ b/plugins/system/system.go @@ -2,6 +2,7 @@ package system import ( "fmt" + gonet "net" "strings" dc "github.com/fsouza/go-dockerclient" @@ -298,8 +299,11 @@ func (s *systemPS) DockerStat() ([]*DockerContainerStat, error) { list, err := s.dockerClient.ListContainers(opts) if err != nil { - fmt.Printf("list err: %s\n", err) - return nil, nil + if _, ok := err.(*gonet.OpError); ok { + return nil, nil + } + + return nil, err } var stats []*DockerContainerStat