dnsmasq container is testing successfully now.

This commit is contained in:
2023-07-29 14:39:37 -07:00
parent 0915d7a018
commit c9cc828907
5 changed files with 25 additions and 23 deletions

View File

@@ -2,20 +2,25 @@
# #
# Create a Debian container which runs dnsmasq. # Create a Debian container which runs dnsmasq.
# https://wiki.debian.org/dnsmasq # https://wiki.debian.org/dnsmasq
# https://computingforgeeks.com/run-and-use-dnsmasq-in-docker-container/?expand_article=1
# #
FROM debian FROM debian
# Remove Existing Config
RUN rm -rfv /etc/{hosts,resolv.conf,dnsmasq.conf}
# Install Dependencies # Install Dependencies
RUN apt update && apt install -y dnsmasq RUN apt-get update && apt-get install -y dnsmasq vim inetutils-ping
# Copy Configuration Files # Copy Configuration Files
COPY ./config/hosts /etc/ RUN mkdir -pv /etc/dnsmasq
COPY ./config/resolv.conf /etc/ COPY ./config/hosts /etc/dnsmasq/hosts
COPY ./config/dnsmasq.conf /etc/ COPY ./config/resolv.conf /etc/dnsmasq/resolv.conf
COPY ./config/dnsmasq.conf /etc/dnsmasq/dnsmasq.conf
## Reload Service # Stop Default Service
RUN service dnsmasq restart RUN service dnsmasq stop
# Load Specific Config Files
CMD dnsmasq -k --log-facility=- --log-queries=extra \
--conf-file=/etc/dnsmasq/dnsmasq.conf \
--no-hosts --addn-hosts=/etc/dnsmasq/hosts \
--resolv-file=/etc/dnsmasq/resolv.conf

View File

@@ -10,11 +10,11 @@
# The local domains being hosted. # The local domains being hosted.
search example.com anotherdomain.com search example.com anotherdomain.com
# Explicitly set local caching with /etc/hosts on. # Explicitly set local caching with hosts file on.
nameserver 127.0.0.1 nameserver 127.0.0.1
# Add any extra settings. # Add any extra settings.
options rotate #options rotate
# Use Cloudflare for upstream DNS. # Use Cloudflare for upstream DNS.
nameserver 1.1.1.1 nameserver 1.1.1.1

View File

@@ -10,14 +10,7 @@ version: '3'
services: services:
app: app:
build: ./ build: ./
restart: on-failure restart: always
ports: ports:
- "53:53" - "53:53/udp"
command: | - "53:53/tcp"
/bin/sh -c '
while :
do
sleep 8h & wait $${!}
service dnsmasq restart
done
'

View File

@@ -1,3 +1,5 @@
#!/bin/bash
#
# 2023-07-29 # 2023-07-29
# Config/DNS/run.sh # Config/DNS/run.sh
# Fix common issues when trying to run this container. # Fix common issues when trying to run this container.
@@ -16,7 +18,7 @@ function stop-service {
fi fi
systemctl disable --now $service && systemctl disable --now $service &&
echo "$service stopped successfully!" || echo "$service stopped successfully!" ||
echo "$service was not found, no problem." echo "* If $service was not found then there is no problem."
} }
echo -e "\n*** Turn off any local DNS programs ***" echo -e "\n*** Turn off any local DNS programs ***"

View File

@@ -1,3 +1,5 @@
#!/bin/bash
#
# 2023-07-29 # 2023-07-29
# Config/DNS/undo.sh # Config/DNS/undo.sh
# Easy way to stop using this container. # Easy way to stop using this container.
@@ -16,7 +18,7 @@ function start-service {
fi fi
systemctl enable --now $service && systemctl enable --now $service &&
echo "$service started successfully!" || echo "$service started successfully!" ||
echo "$service was not found, no problem." echo "* If $service was not found then there is no problem."
} }
echo -e "\n*** Stop the docker container ***" echo -e "\n*** Stop the docker container ***"