From 5a623efc991319f53fd8b86f10a01c5a0baffda0 Mon Sep 17 00:00:00 2001 From: Akshay Chhajed Date: Wed, 24 Jul 2019 23:01:53 +0530 Subject: fix tls config for docker --- image/docker_image.go | 5 +++++ utils/docker.go | 1 + 2 files changed, 6 insertions(+) diff --git a/image/docker_image.go b/image/docker_image.go index 8d9c57e..5cb004f 100644 --- a/image/docker_image.go +++ b/image/docker_image.go @@ -85,6 +85,11 @@ func (image *dockerImageAnalyzer) Fetch() (io.ReadCloser, error) { clientOpts = append(clientOpts, client.WithDialContext(helper.Dialer)) default: + + if os.Getenv("DOCKER_TLS_VERIFY") != "" && os.Getenv("DOCKER_CERT_PATH") == "" { + os.Setenv("DOCKER_CERT_PATH", "~/.docker") + } + clientOpts = append(clientOpts, client.FromEnv) } diff --git a/utils/docker.go b/utils/docker.go index 786a3a4..22bf4c7 100644 --- a/utils/docker.go +++ b/utils/docker.go @@ -12,6 +12,7 @@ func RunDockerCmd(cmdStr string, args ...string) error { allArgs := cleanArgs(append([]string{cmdStr}, args...)) cmd := exec.Command("docker", allArgs...) + cmd.Env = os.Environ() cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr -- cgit v1.2.3