I managed to avoid running as root by making my own entrypoint with:
service apache2 restart
at the start- the full content of
docker/scripts/run.sh
and got it working with the end of my Dockerfile being
# Modify Apache config to use non-privileged port
RUN sed -i 's/Listen 80/Listen 8080/g' /etc/apache2/ports.conf && \
sed -i 's/:80/:8080/g' /etc/apache2/sites-available/001-trame.conf
# Set permissions for logs
RUN mkdir -p /var/log/apache2 && \
chown -R trame-user:trame-user /var/log/apache2
# Set permissions for run directory
RUN mkdir -p /var/run/apache2 && \
chown -R trame-user:trame-user /var/run/apache2
# Set permissions for run directory
RUN mkdir -p /deploy/server/logs/apache/ && \
chown -R trame-user:trame-user /deploy/server/logs/apache/
EXPOSE 8080
USER 1000
ENTRYPOINT [ "/deploy/my_entrypoint.sh" ]