0
votes

I am new to docker and I can't seem to figure this one out...

I have a spring boot application connected to an azure sql database which is running fine in my IDE, but when running my app in a docker container I am getting the following error:

"com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host , port 1433 has failed. Error: ".database.windows.net. 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."

Dockerfile:


COPY pom.xml /build/

COPY src /build/src/

WORKDIR /build/

RUN mvn package

FROM openjdk:8-jre-alpine

WORKDIR /app

ADD target/spring-boot-docker.jar /app/

ENTRYPOINT ["java", "-jar", "spring-boot-docker.jar"]

application.properties:

spring.jpa.hibernate.ddl-auto=update
server.port=8081

spring.datasource.url=jdbc:sqlserver://<hidden>.database.windows.net:1433;database=<hidden>;user=<hidden>;password={your_password_here};encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;
spring.datasource.username=<hidden>
spring.datasource.password=<passhidden>
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
1

1 Answers

0
votes

It's going to be a network connectivity issue.

Chances are high that you can't get out from a dynamic internal port to port 1433 on the server, from within the docker container.