From 0904611df7acb3c3a45e4ddcac1bd35f896dce49 Mon Sep 17 00:00:00 2001
From: Chris Cinelli <chris@allestelle.com>
Date: Thu, 29 Nov 2018 14:22:03 -0800
Subject: [PATCH] Using the same `client.WithVersion(dockerVersion)` as in
 other places. On my machine `ImageInspectWithRaw` was failing for an API
 mismatch and it was always trying to pull (#104)

---
 image/image.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/image/image.go b/image/image.go
index 3c8baaf..fc53851 100644
--- a/image/image.go
+++ b/image/image.go
@@ -202,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.FromEnv)
+	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)
@@ -210,6 +210,7 @@ func InitializeData(imageID string) ([]*Layer, []*filetree.FileTree, float64, fi
 	_, _, err = dockerClient.ImageInspectWithRaw(ctx, imageID)
 	if err != nil {
 		// don't use the API, the CLI has more informative output
+		fmt.Println("Image not available locally... Trying to pull '" + imageID + "'")
 		utils.RunDockerCmd("pull", imageID)
 	}