I am seeing my web
logs with docker-compose logs web
, but I would like to add timestamps to those messages, because now they're quite out of context (don't know when did the event happen). I tried docker-compose logs -t web
, but it seems Docker Compose is unaware of this flag.
Do you have any idea how can I make timestamps appear in Docker Compose logs?
Docker has a dedicated command which lists container logs. The docker logs command. The flow will usually involve you checking your running containers with docker ps, then check the logs by using a container's ID. This command will list all logs for the specified container.
The docker logs command shows information logged by a running container. The docker service logs command shows information logged by all containers participating in a service. The information that is logged and the format of the log depends almost entirely on the container's endpoint command.
You can run the container in foreground mode so you will able to see log. -it keep the container running in foreground as a result you will able to see your container logs. You will able to see live logs same like running application in terminal.
docker-compose version 1.8.0 supports logs, you can use:
docker-compose logs -t
docker-compose
now supports the -t
argument, as pointed out by Ittiel.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With