Web app in one container not able to access web app in another container on windows 10 Professional with docker for windows


I have built two basic hello world Spring boot web application docker images with fabric8 docker-maven-plugin.

Both the web applications use tomcat as the runtime which by default runs on port 8080. I have made the required change in one of the web applications to run tomcat on port 8888.

I have started the web application containers like below

1st web application:
docker run -p 8099:8080 firstwebapp-docker-image

2nd web application (second web application runs on port 8888)
docker run -p 8096:8888 secondwebapp-docker-image

Actually I am trying to access the second web application REST API from the first web application. Basically I am trying to access an application in one container from another container. But I am getting Connection refused exception. In the first web application, I am triggering the second web application URL like http://localhost:8096/, which is NOT working and getting Connection refused exception.

But when I try the same URL ‘http://localhost:8096/’ through the browser it is working fine.

I am trying on Windows 10 professional system with Docker for windows with Hyper-V enabled.

I am not knowing where I am doing wrong. Please help me.

Thank you,