From 6c7d34a77354dc68e0d940336ec80cf0e2b15876 Mon Sep 17 00:00:00 2001 From: Adrian Perez Date: Sat, 2 Jan 2016 18:21:23 +0100 Subject: [PATCH 1/2] fix: use new template for extracting IP I was running into issues with the IP addresses, and it seems that it's using an incorrect/outdated syntax for retrieving the container's IP Address. In multi-host networking `NetworkSettings.IPAddress` is empty. The docker documentation at https://docs.docker.com/engine/reference/commandline/inspect/ uses a different syntax which I've tested to work both on multi-host and standard bridge networking. If you're interested in the other issues and the work/hacks I've been doing related to #1795, let me know. In the meantime, I think this fix is needed. --- dokku | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dokku b/dokku index ada80a2e5..bb162918b 100755 --- a/dokku +++ b/dokku @@ -141,7 +141,7 @@ case "$1" in ipaddr=127.0.0.1 else id=$(docker run -d -e PORT=$port $DOCKER_ARGS $IMAGE $START_CMD) - ipaddr=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $id) + ipaddr=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $id) fi else id=$(docker run -d $DOCKER_ARGS $IMAGE $START_CMD) From 84fba7ff2ba7ed04cdc75069fe7d7d3fa2a1006f Mon Sep 17 00:00:00 2001 From: Adrian Perez Date: Sat, 2 Jan 2016 20:16:03 +0100 Subject: [PATCH 2/2] fix: try to preserve pre 1.9 compatibility --- dokku | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dokku b/dokku index bb162918b..2df18deee 100755 --- a/dokku +++ b/dokku @@ -142,6 +142,10 @@ case "$1" in else id=$(docker run -d -e PORT=$port $DOCKER_ARGS $IMAGE $START_CMD) ipaddr=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $id) + # Docker < 1.9 compatibility + if [[ -z $ipaddr ]]; then + ipaddr=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $id) + fi fi else id=$(docker run -d $DOCKER_ARGS $IMAGE $START_CMD)