Skip to content

Commit

Permalink
Avoid port conflicts (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
osterman authored Nov 17, 2017
1 parent 7b3ea7b commit 8191796
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion rootfs/templates/wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fi
set -o pipefail

# Geodesic Settings
export GEODESIC_PORT=${GEODESIC_PORT:-8001}
export GEODESIC_PORT=${GEODESIC_PORT:-$((30000 + $$%30000))}

STATE_DIR=${STATE_DIR:-${HOME}/.geodesic}
OS=$(uname -s)
Expand Down Expand Up @@ -116,6 +116,7 @@ function use() {
docker exec -it "${DOCKER_NAME}" $*
else
echo "# Starting new ${DOCKER_NAME} session from ${DOCKER_IMAGE}"
echo "# Exposing port ${GEODESIC_PORT}"
docker run "${DOCKER_ARGS[@]}" ${DOCKER_IMAGE} -l $*
fi
}
Expand Down Expand Up @@ -217,6 +218,10 @@ else
export DOCKER_IMAGE=${DOCKER_IMAGE}:${DOCKER_TAG}
fi

if [ -n "${PORT}" ]; then
export GEODESIC_PORT=${PORT}
fi

export DOCKER_DNS=${DNS:-8.8.8.8}

if [ "${GEODESIC_SHELL}" == "true" ]; then
Expand Down

0 comments on commit 8191796

Please sign in to comment.