Docker engine is running on AWS windows server 2016
Here is docker-compose.yml file
version: '3'
services:
controllerdb:
hostname: controllerdb
image: <windows base mysql image>
restart: always
web:
hostname: web
depends_on:
- controllerdb
image: <windows base tomcat image>
restart: always
ports:
- 8080:8080
links:
- controllerdb
networks:
default:
external:
name: nat
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: java.net.UnknownHostException: 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.