Reputation: 38907
I have a few docker containers that require running supervisord.
However, I'm haven't managed to get supervisor to capture the logs and output them to stdout. It seems that supervisor isn't capturing their output and spitting it out in a way that works well with docker. I'd love for it to prepended by the process name or something.
How can I do it? it's not clear from the supervisor manual.
I'd also consider a different tool other than supervisor. One of the downsides of it is that it is written in python which really bloats the docker containers. Along with your solution if you have one, is there a more optimal tool that works better with docker?
Upvotes: 3
Views: 2045
Reputation: 38907
I have found a solution using runit instead.
runit is only slightly more complicated to set up, but not significantly so and logging works out of the box.
Basically you just install runit with apt-get install runit
.
Then create copy a run file to /etc/service/{servicename}/run
The run file is simply a bash script that exec's the name of your service.
It's stdout is captured automatically.
What I was having trouble with was making nginx log to stdout and stderr. I followed a recipe that wrote things to the nginx.conf. It didn't work. What worked was simply:
ln -sf /dev/stdout /var/log/nginx/access.log
ln -sf /dev/stderr /var/log/nginx/error.log
Upvotes: 3