Skip to content

Commit b42bfc3

Browse files
author
OpenShift Bot
committed
Merge pull request #9103 from smarterclayton/use_public_hostname_as_ip
Merged by openshift-bot
2 parents 13e6ef8 + 0b992a2 commit b42bfc3

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

docs/generated/oc_by_example_content.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ Start OpenShift on Docker with reasonable defaults
686686
687687
# Start OpenShift using a specific public host name
688688
oc cluster up --public-hostname=my.address.example.com
689-
689+
690690
# Start OpenShift and preserve data and config between restarts
691691
oc cluster up --host-data-dir=/mydata --use-existing-config
692692

pkg/bootstrap/docker/up.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package docker
33
import (
44
"fmt"
55
"io"
6+
"net"
67
"os"
78
"path/filepath"
89

@@ -68,7 +69,7 @@ A public hostname can also be specified for the server with the --public-hostnam
6869
6970
# Start OpenShift using a specific public host name
7071
%[1]s --public-hostname=my.address.example.com
71-
72+
7273
# Start OpenShift and preserve data and config between restarts
7374
%[1]s --host-data-dir=/mydata --use-existing-config
7475
@@ -633,6 +634,11 @@ func getDockerMachineClient(machine string, out io.Writer) (*docker.Client, erro
633634
}
634635

635636
func (c *ClientStartConfig) determineIP(out io.Writer) (string, error) {
637+
if ip := net.ParseIP(c.PublicHostname); ip != nil && !ip.IsUnspecified() {
638+
fmt.Fprintf(out, "Using public hostname IP %s as the host IP\n", ip)
639+
return ip.String(), nil
640+
}
641+
636642
if len(c.DockerMachine) > 0 {
637643
glog.V(2).Infof("Using docker machine %q to determine server IP", c.DockerMachine)
638644
ip, err := dockermachine.IP(c.DockerMachine)

0 commit comments

Comments
 (0)