I want to provision a Spring Boot app into a Windows Docker Container which is hosted on a Windows Docker Host (which is virtualized on a Mac, but this is another story ;) ) with Ansible. I already successfully used Ansible Windows Modules to provision a Spring Boot app to Windows.
I´am in the final chapter and just wanted to add a health-check at the very end. As outlined in the blogpost without Docker this is easy:
- name: Wait until our Spring Boot app is up & running
win_uri:
url: "http://localhost:8080/health"
method: GET
register: result
until: result.status_code == 200
retries: 5
delay: 5
Now with Docker Windows Containers there´s a known limitation so that you can´t use localhost
for now. We have to use the Windows Docker Containers internal Hyper-V IP address (you can see the IP after you ran a docker inspect <yourContainerIdHere>
inside the JSON output in NetworkSettings.Networks.nat.IPAddress
).
My question is: How can I obtain the Windows Docker Container´s Hyper-V internal IP address, output it inside a debug statement and do a health-check similar to the one I outlined?