How to start a Service in an Alpine Container

1 post / 0 new
#1 Thu, 2017-05-11 20:41
  • scottelundgren's picture
  • Offline
  • Last seen: 1 month 3 weeks ago
  • Joined: 2017-05-11

I'm trying to create a container that runs bind as a forward only DNS resolver that will start with the container. Below is my Dockerfile where I install the bind & openrc a-packs. What should I be doing to start the named service ?

FROM gliderlabs/alpine:latest
RUN apk --update --no-cache add\
COPY named.conf /etc/bind
EXPOSE 53/udp 53/tcp
CMD "rc-update add named boot"

which builds successfully but immediately exits when running the container with docker run --name dns -d --publish 53:53/tcp --publish 53:53/udp <container id>. I'm not sure how I should be interpreting the log message. It seems to be me the /bin/sh is telling me the rc-service binary is not in $PATH. However changing the CMD parameter to /sbin/rc-update add named boot didn't work either:

$ docker logs dns
/bin/sh: rc-service named start: not found