Skip to content

Commit

Permalink
auto forward DOCKER_HOST env var
Browse files Browse the repository at this point in the history
  • Loading branch information
jpbochi committed Feb 16, 2017
1 parent 65bff3f commit efaca24
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drun
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,14 @@ if [ -f '/proc/1/cgroup' ]; then
fi

DSOCK=/var/run/docker.sock
if [ "${MOUNTDOCKERSOCK:-}" != 'n' -a -r "$DSOCK" -a -w "$DSOCK" -a -S "$DSOCK" ]; then
if [ "${MOUNTDOCKERSOCK:-}" != 'n' -a -r "$DSOCK" -a -w "$DSOCK" -a -S "$DSOCK" ]; then
if curl --help | grep -q unix-socket && curl -sS --unix-socket "$DSOCK" http://docker/_ping | grep -q OK; then
EXTRA_OPTS="${EXTRA_OPTS:-} -v ${DSOCK}:${DSOCK}"
elif nc -h 2>&1 | grep -qe '-X\b' && printf 'GET /_ping HTTP/1.1\nHost: daemon\n\n' | nc -U "$DSOCK" | head -n 1 | grep -q '200 OK'; then
EXTRA_OPTS="${EXTRA_OPTS:-} -v ${DSOCK}:${DSOCK}"
fi
elif [ -n "${DOCKER_HOST}" ]; then
EXTRA_OPTS="${EXTRA_OPTS:-} -e DOCKER_HOST=${DOCKER_HOST}"
fi

RM_OPT=${RM_OPT=--rm}
Expand Down

0 comments on commit efaca24

Please sign in to comment.