66 "strings"
77
88 "github.com/docker/machine/libmachine/auth"
9+ "github.com/docker/machine/libmachine/engine"
910 "github.com/docker/machine/libmachine/log"
1011 "github.com/docker/machine/libmachine/mcndockerclient"
1112 "github.com/docker/machine/libmachine/swarm"
@@ -32,13 +33,12 @@ func configureSwarm(p Provisioner, swarmOptions swarm.Options, authOptions auth.
3233 parts := strings .Split (u .Host , ":" )
3334 port := parts [1 ]
3435
35- dockerPort := "2376"
3636 dockerDir := p .GetDockerOptionsDir ()
3737 dockerHost := & mcndockerclient.RemoteDocker {
38- HostURL : fmt .Sprintf ("tcp://%s:%s " , ip , dockerPort ),
38+ HostURL : fmt .Sprintf ("tcp://%s:%d " , ip , engine . DefaultPort ),
3939 AuthOption : & authOptions ,
4040 }
41- advertiseInfo := fmt .Sprintf ("%s:%s " , ip , dockerPort )
41+ advertiseInfo := fmt .Sprintf ("%s:%d " , ip , engine . DefaultPort )
4242
4343 if swarmOptions .Master {
4444 advertiseMasterInfo := fmt .Sprintf ("%s:%s" , ip , "3376" )
@@ -65,9 +65,16 @@ func configureSwarm(p Provisioner, swarmOptions swarm.Options, authOptions auth.
6565 Name : "always" ,
6666 MaximumRetryCount : 0 ,
6767 },
68- Binds : []string {hostBind },
69- PortBindings : map [string ][]dockerclient.PortBinding {"3376/tcp" : {{"" , port }}},
70- NetworkMode : "host" ,
68+ Binds : []string {hostBind },
69+ PortBindings : map [string ][]dockerclient.PortBinding {
70+ "3376/tcp" : {
71+ {
72+ HostIp : "0.0.0.0" ,
73+ HostPort : port ,
74+ },
75+ },
76+ },
77+ NetworkMode : "host" ,
7178 }
7279
7380 swarmMasterConfig := & dockerclient.ContainerConfig {
0 commit comments