Skip to content
This repository has been archived by the owner on Dec 2, 2020. It is now read-only.

Commit

Permalink
Support Docker Toolbox docker daemons
Browse files Browse the repository at this point in the history
Fixes #26
  • Loading branch information
clareliguori committed Sep 3, 2019
1 parent 4dc9f5e commit 23da2fe
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion img2lambda/extract/repack_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,18 @@ func RepackImage(imageName string, layerOutputDir string) (layers []types.Lambda

sys := &imgtypes.SystemContext{}

// Support communicating with Docker for Windows over local plain-text TCP socket
dockerHost := os.Getenv("DOCKER_HOST")

// Support communicating with Docker for Windows over local plain-text TCP socket
if dockerHost == "tcp://localhost:2375" || dockerHost == "tcp://127.0.0.1:2375" {
sys.DockerDaemonHost = strings.Replace(dockerHost, "tcp://", "http://", -1)
}

// Support communicating with Docker Toolbox over encrypted socket
if strings.HasPrefix(dockerHost, "tcp://192.168.") && strings.HasSuffix(dockerHost, ":2376") {
sys.DockerDaemonHost = strings.Replace(dockerHost, "tcp://", "https://", -1)
}

ctx := context.Background()

cache := blobinfocache.DefaultCache(sys)
Expand Down

0 comments on commit 23da2fe

Please sign in to comment.