I created a simple image based on Alpine which uses openrc. When trying to start the hostname (or netowrking) service with service start hostname, the following error occurs:
* Setting hostname ...
hostname: sethostname: Operation not permitted [ !! ]
* ERROR: hostname failed to start
The hostname of the container is set and is correct inside /etc/hostname
Found this post, however I'd prefer not to add SYS_ADMIN cap: Alpine Linux docker set hostname
What is needed to resolve the problem?
Snippet from my Dockerfile:
FROM alpine
VOLUME /sys/fs/cgroup
RUN apk add gitea openrc postgresql15
COPY entrypoint.sh /entrypoint.sh
RUN openrc &&\
touch /run/openrc/softlevel &&\
chmod +x /entrypoint.sh
CMD ["/bin/sh","/entrypoint.sh"]