From 08a6019c24751728fe1cf1cb91d674910368c8be Mon Sep 17 00:00:00 2001 From: Ventz Petkov Date: Sun, 10 Jan 2016 21:56:33 -0500 Subject: [PATCH] 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 --- Dockerfile | 13 ++++++------- entrypoint.sh | 3 +++ 2 files changed, 9 insertions(+), 7 deletions(-) create mode 100755 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index f8b8f42..74b0761 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,14 @@ FROM alpine:latest +EXPOSE 53 + 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" # since we are mounting, do it manually # NOTE: Per Dockerfile manual --> need to mkdir the mounted dir to chown -RUN mkdir /var/cache/bind -RUN chown named:named /var/cache/bind -RUN chmod -R 0775 /var/cache/bind +RUN mkdir -m 0755 -p /var/cache/bind && touch /var/cache/bind/docker-init && chown -R named:named /var/cache/bind # Mounts # NOTE: Per Dockerfile manual --> @@ -17,6 +17,5 @@ RUN chmod -R 0775 /var/cache/bind VOLUME ["/etc/bind"] VOLUME ["/var/cache/bind"] -EXPOSE 53 - -CMD ["/usr/sbin/named", "-c", "/etc/bind/named.conf", "-g", "-u", "named"] +COPY entrypoint.sh / +ENTRYPOINT ["/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..45a591e --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/sh +chown -R named:named /var/cache/bind +/usr/sbin/named -c /etc/bind/named.conf -g -u named