Solution without host bind mount #4

helderco opened this Issue Jul 19, 2015 · 2 comments


None yet

2 participants


Hey, just wanted to share what I did to prevent the need for the host bind mount.

The idea is that I use a different location for the /dev/log socket, so that I can do --volumes-from without conflict. On another container, I just symlink /dev/log to that location. I also send the logs that I want to stderr so that I can do docker logs to get them.

syslog Dockerfile:

FROM debian:jessie

RUN apt-get update && \
    apt-get install rsyslog --no-install-recommends -y && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

COPY rsyslog.conf /etc/
VOLUME /var/run/rsyslog/dev

CMD ["rsyslogd", "-n"]


# load imuxsock module with alternative socket location
input(type="imuxsock" Socket="/var/run/rsyslog/dev/log" CreatePath="on")


# Send your logs to stderr so that `docker logs` works
local1.*  {

Now, for example, in a PHP container you do --volumes-from syslog and run ln -sf /var/run/rsyslog/dev/log /dev/log (I do it in an entrypoint, but you get the idea of what needs to happen).


  build: docker/php
    - syslog

  image: helder/syslog

Now when my PHP container sends something to LOCAL1 using syslog, I get those with docker-compose logs syslog.

jpetazzo commented Aug 5, 2015

Oh, nice! If you wrote about this somewhere (blog post or whatever), I'd be happy to link to it from this project's documentation ... Or, maybe I could add this (and your name) in a markdown file linked from the toplevel README file?

helderco commented Aug 6, 2015

Hey, the only documentation I have is in and an example of a container using it with an entrypoint at the end of

@jpetazzo jpetazzo added a commit that closed this issue Sep 10, 2015
@jpetazzo Update
Closes #4
@jpetazzo jpetazzo closed this in 2687f88 Sep 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment