Search code examples
dockerosx-yosemitesyslogboot2docker

docker error when using log-driver="syslog" on OS X


docker error when using --log-driver="syslog" on OS X

I am trying to learn how to use docker containers on OS X (10.10.3), I understand the differences with the standard Linux implementation ( need boot2docker VM) and I wonder if there is any impact on the way I can log messages with syslog

when I start a container with the --log-driver="syslog" option, the container is created but I get an error upon start

~$ docker run --log-driver="syslog" --name daemon_dwayne -d ubuntu /bin/sh -c "while true; do echo hello_world; sleep 2; done;"
1f623793049916d5c....
FATA[0000] Error response from daemon: Cannot start container 1f623793049916d5....: Unix syslog delivery error

this is running fine on a Linux machine... thanks for any hint


Solution

  • Boot2docker runs in a small linux VM. By default, syslog isn't running in the VM. You can turn it on by running syslogd in the VM e.g:

    $ boot2docker ssh
    ...
    docker@boot2docker:~$ syslogd
    

    If you then try running your container again it should work.

    You can make this change permanent by calling syslogd from the file /var/lib/boot2docker/bootsync.sh inside the boot2docker VM, which boot2docker will execute before starting Docker.