I'm running tftpd-hpa on the ubuntu:16.04 base image. When I run this on a full distro it logs fine but inside a docker container there aren't any logs. It seems to be trying to log to /var/log/syslog which is missing. Does anyone have any suggestions for how I can get some logs from this?

The verbosity is set to 4 which gives suitable verbose output on the full Ubuntu 16.04 install but nothing in the container.



tftpd does not write to log files on it's own. Rather, it logs via syslog (it opens /dev/log and writes messsages there, which are collected by some sort of logging daemon and then dispatched to files based on its configuration).

Inside a typical container there is no logging daemon, so nothing is listening on /dev/log and your log messages simply disappear.

If you want to see those logs when running tftpd inside a container, you will need to have something listen on /dev/log. You have several options:

  • You can mount your host's /dev/log inside the container by adding -v /dev/log:/dev/log to your docker run command line; this will make log messages from tftpd in the container appear in your host's /var/log/... files (final destination dependent on your syslog configuration, but generally something like /var/log/messages).

  • You can run a minimal syslog service in the container and it log to a file. For example, you could install busybox and then run busybox syslogd before you start the tftpd service. For example, your CMD might look like:

    CMD ["sh", "-c", "busybox syslogd; in.tftpd -Lvvv"]

    In this case, the logs would be visible in /var/log/messages inside the container.

  • Instead of writing logs to a file, you could redirect them to the container's stdout. If you modify the above command to have busybox syslogd write to stdout, like this...

    CMD ["sh", "-c", "busybox syslogd -n -O /dev/stdout & in.tftpd -Lvvv"]

    ...then you will see logs on your container's console, where they will also be collected by Docker and made available via docker logs.

This isn't an exhaustive list of solutions, but hopefully it's enough to point you towards a solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.