community.docker
community.docker copied to clipboard
Is it possible to see errors from a container in community.docker.docker_compose_v2?
I would like not to ssh to my server with docker ps -a and after docker logs container_name each time when error occures in any container. And see them immidiately in ansible output. Is it possible?
I'm not sure what exactly you need. A module which allows you to run docker logs <containername> for one / all containers for a service and/or project?
@mihalt can you please provide more details, for example how you would do this without Ansible?
I'm not sure what exactly you need. A module which allows you to run
docker logs <containername>for one / all containers for a service and/or project?
For example I would like to have an option of you collection to choose one of this parameters of showing logs:
- Logs of first failled container with problems (by default)
- Show all failed containers log
- Show last failed container logs
Maybe something like this.
So which command do you run without Ansible to achieve this? The docker_compose_v2 module allows you to run commands like docker compose up, docker compose down, etc.
So which command do you run without Ansible to achieve this? The docker_compose_v2 module allows you to run commands like
docker compose up,docker compose down, etc.
hmm, maybe docker compose logs, could be ok. But output is too big
yes, to see container logs the command is: docker container logs **<container-id>** or **<container-name>**
to go inside the container and see the log the command is: docker container exec -it **<container-name>** bash , to inspect files, logs internal to the container, configuration, etc.
docker compose logs to see the stdout/stderr output from container