Docker Community Forums

Share and learn in the Docker community.

Error response from daemon: failed to initialize logging driver: Unix syslog delivery error

Why does the following docker command:

sudo docker run --log-driver="syslog" --name daemon_dwayne -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1;done"

produce this error message:

Error response from daemon: failed to initialize logging driver: Unix syslog delivery error.

Here’s what I see in Terminal:

This example is from The Docker Book, page 61, Listing 3.22: Enabling Syslog at the container level (PDF book format.)

OS Version/build: macOS 11.6.2 (20G314)
App version: Docker version 20.10.11, build dea9396

I don’t know that book but the example was probably not meant to be used on Mac. You can use the syslog driver if you have a remote Syslog server but the virtual machine on Mac does not include syslog. See the documentation: Syslog logging driver | Docker Documentation

I quote the example:

 docker run \
      --log-driver syslog --log-opt syslog-address=udp://1.2.3.4:1111 \
      alpine echo hello world

If you don’t have a remote syslog and you still want to test it on Mac, you can try to install a Syslog server in a Docker container:

https://hub.docker.com/r/linuxserver/syslog-ng