Update docker images and re-run docker compose up

Hello,

I am working on automating my docker images updates.

For that I get a notification from DIUN, and so far I’m running the update with a simple bash scripts that goes through my docker stack folders, running a docker-compose ps to check if there are any processes, and if so, runs a docker-compose pull & docker compose up -d, which recreates the appropriate containers.

I found that I can do the pull quite easily (I think) by doing a docker_host_info to gather the information, and then use the resulting variable to run a loop on docker_image, but I’m not sure on how to approach the docker-compose up on only already running stacks. Is there a condition I could use to do so? Or do I have to run a ps command manually for such a result?

Thanks,