How to Tail the Log of One Container in a Docker-Compose Group

docker-composeprometheus

I'm still struggling to understand why my ipmi_exporter container will not run in the same "pod" as my Prometheus, Grafana, snmp_exporter and alertmanager. When I bring up the "pod," docker-compose says ipmi_exporter has started but docker-compose ps cannot find the container. I'd like to be able to see the log containing the startup for ipmi_exporter, if that was not made clear in my post title.

Also, what is a docker-compose group of containers called? Pods are a K8s thing.

Best Answer

The docker-compose binary only commands the docker daemon. You can simply use the docker command to get what you need.

Use docker ps or docker ps -a to find out about your containers.

Use docker logs ... with container name to get logs out of a particular container. This works even if you have redirected your logs elsewhere in compose file.

Docker itself sort-of does not have a notion of a "pod". The closest you can get is to define a stack which is a collection of networks, volumes and containers - this is similar to K8s pod. Also, the stack is actually what you define in docker-compose.yml file.

Related Topic