I'm trying to start a docker container, which has 2 services. One of those services needs to be run as a non-root User, otherwise he won't start. The other must run as root.
Now I want to link the non_root_service.log
file to either /dev/tty
or /dev/stdout
, so that the logs could be catched by docker (check with docker logs $CONTAINER
):
ln -s /dev/stdout non_root_service.log
The Problem is by doing so, that the non-root User has no rights to write to either /dev/tty
or /dev/stdout
resulting in the following error on startup of the non-root-service:
cannot open "non_root_service.log": Permission denied
But if I don't create the link, I could not catch the logs with docker logs $CONTAINER
. Does anyone has an idea how that could be fixed, so that I could run the user as non-root AND link the log files to /dev/{tty,stdout}
?
P.S.: Does not matter if I use as shell script CMD ["starter.sh"]
or supervisor CMD ["supervisord", "-n", "-c", "/app/supervisord.conf"]
to start the 2 services, I get with both the same error.