Use 'setcap' to bind to port 53 in the container

This commit is contained in:
George Tankersley 2020-06-09 17:42:48 -04:00
parent c7d1423bfd
commit e66a787844
2 changed files with 10 additions and 5 deletions

View File

@ -22,15 +22,20 @@ RUN echo "replace github.com/btcsuite/btcd => github.com/gtank/btcd v0.0.0-20191
RUN make all \
&& mv coredns /usr/bin/coredns
FROM alpine:latest
RUN apk --no-cache add libcap
COPY --from=builder /usr/bin/coredns /usr/bin/coredns
COPY --from=builder /etc/ssl/certs/ /etc/ssl/certs
COPY coredns/Corefile /etc/dnsseeder/Corefile
# DNS will bind to 8053
EXPOSE 8053
RUN setcap 'cap_net_bind_service=+ep' /usr/bin/coredns
# DNS will bind to 53
EXPOSE 53
# Global health check will respond 200 OK on 8080
EXPOSE 8080
@ -41,4 +46,4 @@ RUN adduser --disabled-password dnsseeder
USER dnsseeder
ENTRYPOINT [ "coredns" ]
CMD [ "-conf", "/etc/dnsseeder/Corefile", "-dns.port", "8053"]
CMD [ "-conf", "/etc/dnsseeder/Corefile"]

View File

@ -1,6 +1,6 @@
.PHONY: docker docker-run docker-clean install uninstall all clean
VERSION=v0.1.0
VERSION=v0.1.1
all: build_output/coredns
@ -23,7 +23,7 @@ docker:
docker build -t zfnd-seeder:$(VERSION) -f Dockerfile .
docker-run:
docker run -d --rm -p 1053:8053/udp -p 1053:8053/tcp -p 8080 zfnd-seeder:$(VERSION)
docker run -d --rm -p 1053:53/udp -p 1053:53/tcp -p 8080 zfnd-seeder:$(VERSION)
docker-clean:
docker rmi zfnd-seeder:$(VERSION)