Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cluster up: override port forwarding if using docker machine #9993

Merged
merged 1 commit into from
Jul 25, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions pkg/bootstrap/docker/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,18 @@ func (c *ClientStartConfig) determineIP(out io.Writer) (string, error) {
return ip.String(), nil
}

if len(c.DockerMachine) > 0 {
// If a docker machine is specified, port forwarding will not be used
c.PortForwarding = false
glog.V(2).Infof("Using docker machine %q to determine server IP", c.DockerMachine)
ip, err := dockermachine.IP(c.DockerMachine)
if err != nil {
return "", errors.NewError("Could not determine IP address").WithCause(err).WithSolution("Ensure that docker-machine is functional.")
}
fmt.Fprintf(out, "Using docker-machine IP %s as the host IP\n", ip)
return ip, nil
}

// If using port-forwarding, find a local IP that can be used to communicate with the
// Origin container
if c.PortForwarding {
Expand Down Expand Up @@ -763,16 +775,6 @@ func (c *ClientStartConfig) determineIP(out io.Writer) (string, error) {
return "", errors.NewError("could not determine local IP address to use").WithCause(err)
}

if len(c.DockerMachine) > 0 {
glog.V(2).Infof("Using docker machine %q to determine server IP", c.DockerMachine)
ip, err := dockermachine.IP(c.DockerMachine)
if err != nil {
return "", errors.NewError("Could not determine IP address").WithCause(err).WithSolution("Ensure that docker-machine is functional.")
}
fmt.Fprintf(out, "Using docker-machine IP %s as the host IP\n", ip)
return ip, nil
}

// First, try to get the host from the DOCKER_HOST if communicating via tcp
var err error
ip := c.DockerHelper().HostIP()
Expand Down