Docker Community Forums

Share and learn in the Docker community.

How to access Database using domain name from windonws docker container


(Dvekaria) #1

Getting error as below:

Error: The TCP/IP connection to the host *(my database server ip address), port *(database port) has failed. Error: "connect timed out. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall. ".

Database string: jdbc:sqlserver://dns:port;DatabaseName=testdb

Using Docker Windows container


FROM openjdk:8
ADD target/dv-2.war dv-2.war
ENTRYPOINT ["java","-jar","dv-2.war"]

Build image from Project: docker build -f DockerfileWar -t dv-2war .

docker run -p 8085:8085 dv-1war

Getting above error while run the container.

Note: If i used the IP address at DNS than it is working. But i want to do with DNS only. Just for note database running on some other machine(Not on any container). Spring boot application running on docker windows container.



Did you figure this out ? I’m running into the same issue. Docker container running Spring boot app, connecting to a database hosted on a VM. Using Docker for Windows.