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.