It is a best practice for any good application to generate some logging information that developers and operators alike can use to find out what the application is doing at a given time, and whether there are any problems to help to pinpoint the root cause of the issue.
When running inside a container, the application should preferably output the log items to STDOUT and STDERR and not into a file. If the logging output is directed to STDOUT and STDERR, then Docker can collect this information and keep it ready for consumption by a user or any other external system:
- To access the logs of a given container, we can use the docker container logs command. If, for example, we want to retrieve the logs of our trivia container, we can use the following expression:
$ docker container logs trivia
This will retrieve the whole log...