Commit 88a9ee71 authored by Emeric Verschuur's avatar Emeric Verschuur

Improve docker-dns option check

parent 45d4de66
...@@ -226,6 +226,18 @@ citbx_check_env() { ...@@ -226,6 +226,18 @@ citbx_check_env() {
if [ ! -f "$setupsh" ]; then if [ ! -f "$setupsh" ]; then
print_critical "OS variant '$os_id' not supported (missing $setupsh)" print_critical "OS variant '$os_id' not supported (missing $setupsh)"
fi fi
check_dns() {
case "$1" in
::1|127.*)
print_error "Local $1 DNS server cannot be used with docker containers"
return 1
;;
*)
echo "$1"
;;
esac
}
bashopts_process_option -n CITBX_DOCKER_DNS_LIST -r -k check_dns
. "$setupsh" . "$setupsh"
print_info "System setup complete" "On a first install, a system reboot may be necessary" print_info "System setup complete" "On a first install, a system reboot may be necessary"
exit 0 exit 0
...@@ -382,7 +394,12 @@ case "$command" in ...@@ -382,7 +394,12 @@ case "$command" in
bashopts_declare -n CITBX_DOCKER_FIXED_CIDR -l docker-cdir -v "192.168.255.0/24" \ bashopts_declare -n CITBX_DOCKER_FIXED_CIDR -l docker-cdir -v "192.168.255.0/24" \
-t string -s -i -d "Local docker network IPV4 prefix" -t string -s -i -d "Local docker network IPV4 prefix"
bashopts_declare -n CITBX_DOCKER_DNS_LIST -l docker-dns -m add \ bashopts_declare -n CITBX_DOCKER_DNS_LIST -l docker-dns -m add \
-e "($(cat /etc/resolv.conf | awk '/^nameserver/ {printf(" %s", $2)}') )" \ -e "($( jq -r '.dns[]' /etc/docker/daemon.json 2> /dev/null | tr '\n' ' ' \
|| cat /etc/resolv.conf | awk '/^nameserver/ {
if ($2 !~ /^127\..*/ && $2 != "::1" ) {
printf(" %s", $2);
}
}' ) )" \
-t string -s -i -d "Docker DNS" -t string -s -i -d "Docker DNS"
;; ;;
update) update)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment