Switch to host networking

This commit is contained in:
David Blacka 2023-02-26 14:44:24 -05:00
parent 2788c11bed
commit f091a8946c
2 changed files with 19 additions and 10 deletions

View File

@ -7,9 +7,7 @@ options {
listen-on { any; }; listen-on { any; };
listen-on-v6 { ::1; }; listen-on-v6 { ::1; };
# hopefully the default docker bridge network allow-recursion { 127.0.0.1; ::1; };
# is consistently in 172.17.0.0/24
allow-recursion { 127.0.0.1; ::1; 172.17.0.0/24; };
dnssec-validation yes; dnssec-validation yes;
}; };

View File

@ -1,8 +1,6 @@
#! /bin/bash #! /bin/bash
BASE_CONF_DIR=/etc/bind BASE_CONF_DIR=/etc/bind
: "${DNS_PORT:=53}"
: "${RNDC_PORT:=953}"
CMD="/etc/bind/run.sh" CMD="/etc/bind/run.sh"
[ "$1" = "interactive" ] && ARGS="-ti --entrypoint=/bin/bash" && CMD="" [ "$1" = "interactive" ] && ARGS="-ti --entrypoint=/bin/bash" && CMD=""
@ -10,12 +8,25 @@ CMD="/etc/bind/run.sh"
docker run $ARGS \ docker run $ARGS \
--rm \ --rm \
--name=bind9 \ --name=bind9 \
--add-host=host.docker.internal:host-gateway \ --network=host \
--publish "$RNDC_PORT:953/tcp" \
--publish "$DNS_PORT:53/udp" \
--publish "$DNS_PORT:53/tcp" \
-v $BASE_CONF_DIR/cfg:/etc/bind \ -v $BASE_CONF_DIR/cfg:/etc/bind \
-v $BASE_CONF_DIR/cache:/var/cache/bind \ -v $BASE_CONF_DIR/cache:/var/cache/bind \
-v $BASE_CONF_DIR/zones:/var/lib/bind \ -v $BASE_CONF_DIR/zones:/var/lib/bind \
-v $BASE_CONF_DIR/log:/var/log \ -v $BASE_CONF_DIR/log:/var/log \
docker.io/internetsystemsconsortium/bind9:9.18 $CMD docker.io/internetsystemsconsortium/bind9:9.18 $CMD
# using bridge networking
# : "${DNS_PORT:=53}"
# : "${RNDC_PORT:=953}"
# docker run $ARGS \
# --rm \
# --name=bind9 \
# --add-host=host.docker.internal:host-gateway \
# --publish "$RNDC_PORT:953/tcp" \
# --publish "$DNS_PORT:53/udp" \
# --publish "$DNS_PORT:53/tcp" \
# -v $BASE_CONF_DIR/cfg:/etc/bind \
# -v $BASE_CONF_DIR/cache:/var/cache/bind \
# -v $BASE_CONF_DIR/zones:/var/lib/bind \
# -v $BASE_CONF_DIR/log:/var/log \
# docker.io/internetsystemsconsortium/bind9:9.18 $CMD