I have unit tests running on my build server and would like to capture the log results for analysis when something fails. I have yet to find a way to redirect the output of
By default docker uses the json-file driver to record your containers logs and the raw json output of the logs can be found in:
/var/lib/docker/containers/[container-id]/[container-id]-json.log
You can get this location by running:
docker inspect --format='{{.LogPath}}' [container-id or container-name]
When you run docker-compose logs [service-name], docker-compose will attach to the service (container) you reference and the LogPrinter object will output the contents of the above file, but formatted so they're easier to read.
Related docs: https://docs.docker.com/compose/compose-file/#logging