Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ RUN \
FROM alpine:3.7
RUN apk add --no-cache ca-certificates
COPY --from=builder /go/src/github.com/gliderlabs/registrator/bin/registrator /bin/registrator

ENTRYPOINT ["/bin/registrator"]
COPY --from=builder /go/src/github.com/gliderlabs/registrator/docker-entrypoint.sh /usr/local/bin/
RUN chmod 777 /usr/local/bin/docker-entrypoint.sh
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["/bin/registrator"]
20 changes: 20 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh
set -e

REGISTRATOR_BIND=
if [ -n "$REGISTRATOR_BIND_INTERFACE" ]; then
REGISTRATOR_BIND_ADDRESS=$(ip -o -4 addr list $REGISTRATOR_BIND_INTERFACE | head -n1 | awk '{print $4}' | cut -d/ -f1)
if [ -z "$REGISTRATOR_BIND_ADDRESS" ]; then
echo "Could not find IP for interface '$REGISTRATOR_BIND_INTERFACE', exiting"
exit 1
fi

REGISTRATOR_BIND="-ip $REGISTRATOR_BIND_ADDRESS"
echo "==> Found address '$REGISTRATOR_BIND_ADDRESS' for interface '$REGISTRATOR_BIND_INTERFACE', setting bind option..."
fi

set -- registrator \
$REGISTRATOR_BIND \
"$@"

exec "$@"