Added an entry point to chown /var/cache/bind in run time, in case you are mounting over with a folder that is owned by root

This commit is contained in:
Ventz Petkov 2016-01-10 21:56:33 -05:00
parent 642ec12fe6
commit 08a6019c24
2 changed files with 9 additions and 7 deletions

View File

@ -1,14 +1,14 @@
FROM alpine:latest FROM alpine:latest
EXPOSE 53
RUN apk --update add bind RUN apk --update add bind
RUN mkdir -m 0755 -p /var/run/named && chown root:named /var/run/named RUN mkdir -m 0755 -p /var/run/named && chown -R root:named /var/run/named
# /var/cache/bind needs to be owned by "bind" # /var/cache/bind needs to be owned by "bind"
# since we are mounting, do it manually # since we are mounting, do it manually
# NOTE: Per Dockerfile manual --> need to mkdir the mounted dir to chown # NOTE: Per Dockerfile manual --> need to mkdir the mounted dir to chown
RUN mkdir /var/cache/bind RUN mkdir -m 0755 -p /var/cache/bind && touch /var/cache/bind/docker-init && chown -R named:named /var/cache/bind
RUN chown named:named /var/cache/bind
RUN chmod -R 0775 /var/cache/bind
# Mounts # Mounts
# NOTE: Per Dockerfile manual --> # NOTE: Per Dockerfile manual -->
@ -17,6 +17,5 @@ RUN chmod -R 0775 /var/cache/bind
VOLUME ["/etc/bind"] VOLUME ["/etc/bind"]
VOLUME ["/var/cache/bind"] VOLUME ["/var/cache/bind"]
EXPOSE 53 COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/usr/sbin/named", "-c", "/etc/bind/named.conf", "-g", "-u", "named"]

3
entrypoint.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
chown -R named:named /var/cache/bind
/usr/sbin/named -c /etc/bind/named.conf -g -u named