-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
executable file
·45 lines (39 loc) · 1001 Bytes
/
docker-entrypoint.sh
File metadata and controls
executable file
·45 lines (39 loc) · 1001 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
#
# Colin Mollenhour
# Clear the file so that it will be run on container restart
>/usr/local/bin/iptables.sh
# Fix issues with iptables-legacy
if [[ "$IPTABLES_NFT" != "1" ]]; then
update-alternatives --set iptables /usr/sbin/iptables-legacy || true
fi
case "$FW_MODE" in
docker|host)
cp /etc/confd/configs/docker.toml /etc/confd/conf.d
;;
kontena)
cp /etc/confd/configs/kontena.toml /etc/confd/conf.d
;;
*)
echo "FW_MODE is not set."
exit 1;
;;
esac
if [[ -n "$ETCD_URL" ]]; then
ARGS="$ARGS -watch -backend etcd -node $ETCD_URL"
else
ARGS="$ARGS -onetime -backend env"
fi
if [[ $DEBUG -eq 1 ]]; then
ARGS="$ARGS -log-level debug"
fi
echo "Starting confd in $FW_MODE mode with args: $@ $ARGS"
# TODO - catch TERM/KILL signal and run `iptables.sh disable` before exiting
if [[ -n "$ETCD_URL" ]]; then
exec "$@" $ARGS
else
"$@" $ARGS
/usr/local/bin/iptables.sh | /sbin/iptables-restore --counters
echo "Sleeping forever..."
sleep inf
fi