diff options
author | Nathan Lowe <public@nlowe.me> | 2018-10-31 13:12:52 -0400 |
---|---|---|
committer | Alex Goodman <wagoodman@users.noreply.github.com> | 2018-10-31 13:12:52 -0400 |
commit | 4b6ff484e3757e618e9fc529e978912ecf6dc9b0 (patch) | |
tree | 01edd89eadea18268232a0590e651185e2d1df1e /image | |
parent | 81cbb143da47aadae8c05da18226db2ac79bffa6 (diff) |
#29: Support configuring the docker client from environment variables (#54)
Diffstat (limited to 'image')
-rw-r--r-- | image/image.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/image/image.go b/image/image.go index dcd6210..2706692 100644 --- a/image/image.go +++ b/image/image.go @@ -6,13 +6,14 @@ import ( "bytes" "encoding/json" "fmt" - "github.com/sirupsen/logrus" "io" "io/ioutil" "os" "path/filepath" "strings" + "github.com/sirupsen/logrus" + "github.com/docker/docker/client" "github.com/wagoodman/dive/filetree" "github.com/wagoodman/dive/utils" @@ -201,7 +202,7 @@ func InitializeData(imageID string) ([]*Layer, []*filetree.FileTree, float64, fi // pull the image if it does not exist ctx := context.Background() - dockerClient, err := client.NewClientWithOpts(client.WithVersion(dockerVersion)) + dockerClient, err := client.NewClientWithOpts(client.WithVersion(dockerVersion), client.FromEnv) if err != nil { fmt.Println("Could not connect to the Docker daemon:" + err.Error()) utils.Exit(1) @@ -334,7 +335,7 @@ func InitializeData(imageID string) ([]*Layer, []*filetree.FileTree, float64, fi func saveImage(imageID string) (string, string) { ctx := context.Background() - dockerClient, err := client.NewClientWithOpts(client.WithVersion(dockerVersion)) + dockerClient, err := client.NewClientWithOpts(client.WithVersion(dockerVersion), client.FromEnv) if err != nil { fmt.Println("Could not connect to the Docker daemon:" + err.Error()) utils.Exit(1) |