Skip to content

Commit b532ba0

Browse files
committed
Fix Verifying Deployment when using the host network
1 parent 315da92 commit b532ba0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/plugins/meteor/assets/meteor-deploy-check.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ APP_PATH=/opt/$APPNAME
55
IMAGE=mup-<%= appName.toLowerCase() %>
66
START_SCRIPT=$APP_PATH/config/start.sh
77
DEPLOY_CHECK_WAIT_TIME=<%= deployCheckWaitTime %>
8-
CONTAINER_IP=$(docker inspect $APPNAME --format "{{.NetworkSettings.IPAddress}}")
9-
DEPLOY_CHECK_URL=$CONTAINER_IP<%= `:${deployCheckPort}` %>
8+
9+
# Check if using host network.
10+
$(docker inspect $APPNAME --format "{{(index .NetworkSettings.Networks)}}" | grep -q '\[host')
11+
HOST_NETWORK=$?
1012

1113
cd $APP_PATH
1214

@@ -52,7 +54,11 @@ while [[ true ]]; do
5254

5355
# If the container restarted, the ip address would have changed
5456
# Get the current ip address right before it is used
55-
CONTAINER_IP=$(docker inspect $APPNAME --format "{{.NetworkSettings.IPAddress}}")
57+
if [[ $HOST_NETWORK ]]; then
58+
CONTAINER_IP="localhost"
59+
else
60+
CONTAINER_IP=$(docker inspect $APPNAME --format "{{.NetworkSettings.IPAddress}}")
61+
fi
5662

5763
if [[ -z $CONTAINER_IP ]]; then
5864
echo "Container has no IP Address, likely from it restarting."

0 commit comments

Comments
 (0)