You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently it's only possible to use state absent, present, stopped and started for the docker_container module. I would like to propose adding state: healthy to have Ansible wait until the integrated HEALTHCHECK returns healthy (when defined in the Dockerfile).
ISSUE TYPE
Feature Idea
COMPONENT NAME
community.docker.docker_container
ADDITIONAL INFORMATION
By implementing this feature, a playbook can halt execution until the docker_container healtcheck returns healthy. This prevents additional tasks to poll for the health manually.
- name: Create database containerdocker_container:
name: "database"image: "mysql:latest"state: "healthy"# This will trigger Ansible to wait for the HEALTHCHECK statement to return healthy, and fail if unhealthy.restart: truedetach: truepull: "always"restart_policy: alwayspublished_ports:
- "{{ db_fixture_port }}:3306"
The text was updated successfully, but these errors were encountered:
Another idea would be to (also) have a separate module which allows to wait for several contains at once to reach the healthy state. That would allow users to start several containers first with the docker_container module, and then wait until all of them are healthy afterwards. This is likely faster than waiting for each to be healthy before starting the next.
Your case can then also be split up into just two tasks (without any explicit polling).
Obviously that doesn't mean that a state=healthy (or something similar) doesn't make sense / shouldn't be implemented, I think it's just more flexible to also have a separate module for just waiting :)
SUMMARY
Currently it's only possible to use state
absent
,present
,stopped
andstarted
for the docker_container module. I would like to propose addingstate: healthy
to have Ansible wait until the integrated HEALTHCHECK returns healthy (when defined in the Dockerfile).ISSUE TYPE
COMPONENT NAME
community.docker.docker_container
ADDITIONAL INFORMATION
By implementing this feature, a playbook can halt execution until the docker_container healtcheck returns healthy. This prevents additional tasks to poll for the health manually.
The text was updated successfully, but these errors were encountered: