Merge pull request #3818 from dokku/host-networking-support
Add support for host-mode networking
This commit is contained in:
2 files changed
+23
No files matched your search
@@ -95,6 +95,12 @@ func GetContainerIpaddress(appName, processType, containerID string) (ipAddr str
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if b, err := common.DockerInspect(containerID, "'{{ .HostConfig.NetworkMode }}'"); err == nil {
|
||||||
|
if string(b[:]) == "host" {
|
||||||
|
return "127.0.0.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
b, err := common.DockerInspect(containerID, "'{{.NetworkSettings.Networks.bridge.IPAddress}}'")
|
b, err := common.DockerInspect(containerID, "'{{.NetworkSettings.Networks.bridge.IPAddress}}'")
|
||||||
if err != nil || len(b) == 0 {
|
if err != nil || len(b) == 0 {
|
||||||
// docker < 1.9 compatibility
|
// docker < 1.9 compatibility
|
||||||
|
|||||||
@@ -67,3 +67,20 @@ assert_external_port() {
|
|||||||
assert_external_port $(< $CID_FILE) failure
|
assert_external_port $(< $CID_FILE) failure
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "(proxy) network host-mode" {
|
||||||
|
run /bin/bash -c "dokku docker-options:add $TEST_APP deploy \"--network=host\""
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
run deploy_app
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
run /bin/bash -c "curl --silent --write-out '%{http_code}\n' `dokku url $TEST_APP` | grep 200"
|
||||||
|
echo "output: $output"
|
||||||
|
echo "status: $status"
|
||||||
|
assert_success
|
||||||
|
}
|
||||||
Reference in new issue
Block a user