mirror of
				https://github.com/11notes/docker-bind.git
				synced 2025-11-04 05:43:13 +00:00 
			
		
		
		
	switch to OpenDNS
This commit is contained in:
		
							
								
								
									
										35
									
								
								Dockerfile
									
									
									
									
									
								
							
							
						
						
									
										35
									
								
								Dockerfile
									
									
									
									
									
								
							@@ -1,21 +1,24 @@
 | 
			
		||||
# ------ Header ------ #
 | 
			
		||||
FROM alpine:latest
 | 
			
		||||
# :: Header
 | 
			
		||||
FROM alpine:3.9
 | 
			
		||||
 | 
			
		||||
#   // add bind
 | 
			
		||||
RUN apk update \
 | 
			
		||||
    && apk add --update bash \
 | 
			
		||||
    && apk add --no-cache bind
 | 
			
		||||
# :: Run
 | 
			
		||||
USER root
 | 
			
		||||
 | 
			
		||||
#   // create directory for zone configuration files
 | 
			
		||||
RUN mkdir -p /var/zones \
 | 
			
		||||
#   // delete default files
 | 
			
		||||
    && rm -R /etc/bind/*
 | 
			
		||||
RUN mkdir -p /bind/etc \
 | 
			
		||||
    && mkdir -p /bind/var
 | 
			
		||||
 | 
			
		||||
#   // add default bind config for internal, external view + recursion
 | 
			
		||||
ADD ./named.conf /etc/bind/named.conf
 | 
			
		||||
RUN apk --update --no-cache add \
 | 
			
		||||
    bash \
 | 
			
		||||
    bind
 | 
			
		||||
 | 
			
		||||
# ------ define volumes ------ #
 | 
			
		||||
VOLUME ["/etc/bind", "/var/zones"]
 | 
			
		||||
RUN rm -R /etc/bind
 | 
			
		||||
 | 
			
		||||
# ------ entrypoint for container ------ #
 | 
			
		||||
CMD ["/usr/sbin/named", "-fg", "-c", "/etc/bind/named.conf"]
 | 
			
		||||
ADD ./source/named.conf /bind/etc/named.conf
 | 
			
		||||
ADD ./source/zones.conf /bind/etc/zones.conf
 | 
			
		||||
 | 
			
		||||
# :: Volumes
 | 
			
		||||
VOLUME ["/bind/etc", "/bind/var"]
 | 
			
		||||
 | 
			
		||||
# :: Start
 | 
			
		||||
USER named
 | 
			
		||||
CMD ["/usr/sbin/named", "-fg", "-c", "/bind/etc/named.conf"]
 | 
			
		||||
							
								
								
									
										25
									
								
								named.conf
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								named.conf
									
									
									
									
									
								
							@@ -1,25 +0,0 @@
 | 
			
		||||
options {
 | 
			
		||||
	listen-on { any; };
 | 
			
		||||
	directory "/etc/bind";
 | 
			
		||||
	recursion no;
 | 
			
		||||
	allow-notify { none; };
 | 
			
		||||
	forwarders { 8.8.8.8; 8.8.4.4; };
 | 
			
		||||
	version "0.0";
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
acl acl-internal {
 | 
			
		||||
	10.0.0.0/8;
 | 
			
		||||
	172.16.0.0/12;
 | 
			
		||||
    192.168.0.0/16;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
view "internal" {
 | 
			
		||||
	match-clients { acl-internal; };
 | 
			
		||||
	allow-query { acl-internal; };
 | 
			
		||||
	recursion yes;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
view "external" {
 | 
			
		||||
	match-clients { any; };
 | 
			
		||||
	recursion no;
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										18
									
								
								source/named.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								source/named.conf
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
options {
 | 
			
		||||
        listen-on { any; };
 | 
			
		||||
        directory "/bind/etc";
 | 
			
		||||
        recursion no;
 | 
			
		||||
        allow-notify { none; };
 | 
			
		||||
        forwarders { 208.67.220.220; 208.67.222.222; };
 | 
			
		||||
        version "0.0";
 | 
			
		||||
        auth-nxdomain no;
 | 
			
		||||
        max-cache-size 256m;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
acl acl-internal {
 | 
			
		||||
	10.0.0.0/8;
 | 
			
		||||
	172.16.0.0/12;
 | 
			
		||||
    192.168.0.0/16;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
include "zones.conf";
 | 
			
		||||
							
								
								
									
										10
									
								
								source/zones.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								source/zones.conf
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
view "internal" {
 | 
			
		||||
	match-clients { acl-internal; };
 | 
			
		||||
	allow-query { acl-internal; };
 | 
			
		||||
	recursion yes;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
view "external" {
 | 
			
		||||
	match-clients { any; };
 | 
			
		||||
	recursion no;
 | 
			
		||||
};
 | 
			
		||||
		Reference in New Issue
	
	Block a user