That would be a consequence of the init
program we inject into VMs to create a clean startup sequence.
We do not encourage people to run their programs as root. I’d suggest writing a custom entrypoint for your image, running as root, that creates the structure you want in /run
with the permissions you need. Then switch to the proper user and exec
your CMD.
For example:
entrypoint.sh
#!/bin/bash
# assume you're root
chown -R nobody:nobody /run
# switch back to nobody user
su - nobody
# exec the original CMD
exec "$@"
Dockerfile
FROM trafex/alpine-nginx-php7
# ...
COPY ./entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
USER root
I see the Dockerfile for trafex/alpine-nginx-php7
modifies the ownership of /run
during build. We might be able to do detect that and keep the current ownership and permissions.
In the meantime, something like the example I provided should work.