出现如下错误:
Error: com.microsoft.sqlserver.jdbc.SQLServerException: 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.
”。
数据库字符串:jdbc:sqlserver://dns:port;DatabaseName=testdb
使用Docker Windows容器
DockerfileWar:
FROM openjdk:8
ADD target/dv-2.war dv-2.war
EXPOSE 8085
ENTRYPOINT ["java","-jar","dv-2.war"]
从项目构建映像:docker build -f DockerfileWar -t dv-2war。
docker run -p 8085:8085 dv-1war
在运行容器时遇到上述错误。
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.
感谢,达瓦尔