Docker Community Forums

Share and learn in the Docker community.

How to establish connection between Web & Database (windows base) docker container , running through docker-compose file?

Docker engine is running on AWS windows server 2016

Here is docker-compose.yml file

version: '3'
            hostname: controllerdb
            image: <windows base mysql image>
            restart: always
            hostname: web
                - controllerdb
            image: <windows base tomcat image>
            restart: always
                - 8080:8080
                - controllerdb

For connecting with database URL in tomcat

URL = jdbc:mysql://controllerdb:3306/database_name"

But on running compose file its giving error

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
 The last packet sent successfully to the server was 0 milliseconds ago. The driver has not 
 received any packets from the server.
 **Caused by: controllerdb**

Even after providing correct hostname , its giving UnknownHostException.

This connection work with linux container but I want to establish it in windows container.

Please , let me know how to fix it, So that inter container communication in windows containers can be done.