Update to allow the new locations for Docker for Mac socket paths

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack 2018-05-10 13:32:38 +01:00
parent 11ea1ed080
commit 415d0d3c32
No known key found for this signature in database
GPG Key ID: 609102888A2EE3F9

View File

@ -259,8 +259,22 @@ func runHyperKit(args []string) {
netMode := strings.SplitN(*networking, ",", 3)
switch netMode[0] {
case hyperkitNetworkingDockerForMac:
h.VPNKitSock = filepath.Join(os.Getenv("HOME"), "Library/Containers/com.docker.docker/Data/s50")
vpnkitPortSocket = filepath.Join(os.Getenv("HOME"), "Library/Containers/com.docker.docker/Data/s51")
oldEthSock := filepath.Join(os.Getenv("HOME"), "Library/Containers/com.docker.docker/Data/s50")
oldPortSock := filepath.Join(os.Getenv("HOME"), "Library/Containers/com.docker.docker/Data/s51")
newEthSock := filepath.Join(os.Getenv("HOME"), "Library/Containers/com.docker.docker/Data/vpnkit.eth.sock")
newPortSock := filepath.Join(os.Getenv("HOME"), "Library/Containers/com.docker.docker/Data/vpnkit.port.sock")
_, err := os.Stat(oldEthSock)
if err == nil {
h.VPNKitSock = oldEthSock
vpnkitPortSocket = oldPortSock
} else {
_, err = os.Stat(newEthSock)
if err != nil {
log.Fatalln("Cannot find Docker for Mac network sockets. Install Docker or use a different network mode.")
}
h.VPNKitSock = newEthSock
vpnkitPortSocket = newPortSock
}
case hyperkitNetworkingVPNKit:
if len(netMode) > 1 {
// Socket path specified, try to use existing VPNKit instance