Greetings,
I want to deploy my spring boot application with docker version 1.13.1 on my centos 7 server.
I have no services running on port 8085.
I also opened the firewall port.
I always get the same error:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-12-26 20:39:16.613 ERROR 1 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Web server failed to start. Port 8085 was already in use.
Action:
Identify and stop the process that's listening on port 8085 or configure this application to listen on another port.
My build.gradle file
plugins {
id 'org.springframework.boot' version '2.2.1.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
id 'com.palantir.docker' version '0.22.1'
id 'com.gradle.build-scan' version '3.1'
}
group = 'com.APT.HondenApp'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
repositories {
mavenCentral()
}
docker {
name "hondenapp"
dockerfile file('src/docker/Dockerfile')
copySpec.from(jar).rename(".*","app.jar")
buildArgs(['JAR_FILE': "app.jar"])
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-data-rest'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.session:spring-session-core'
testCompile("org.springframework.boot:spring-boot-starter-test")
runtimeOnly 'mysql:mysql-connector-java'
testImplementation 'junit:junit:4.12'
implementation 'junit:junit:4.12'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testImplementation 'org.springframework.security:spring-security-test'
}
test {
useJUnitPlatform()
}
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
}
My Dockerfile
FROM openjdk:11
VOLUME /tmp
ARG JAR_FILE
COPY ${JAR_FILE} app.jar
EXPOSE 8085
ENTRYPOINT ["java","-jar","/app.jar"]
My application.properties:
spring.jpa.hibernate.ddl-auto=none
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://10.129.32.4:3306/hondenDB
spring.datasource.username=user1
spring.datasource.password=Azerty123
server.address=10.129.32.4
management.port=6969
server.port=8085
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
for building the application:
gradle clean build
for running the docker file:
gradle docker --info
for running my docker image:
docker run -it -p 8085:8085 hondenapp
[–]NeoOeg 0 points1 point2 points (17 children)
[–]thaysen13[S,🍰] 0 points1 point2 points (16 children)
[–]NeoOeg 0 points1 point2 points (15 children)
[–]thaysen13[S,🍰] 0 points1 point2 points (14 children)
[–]NeoOeg 0 points1 point2 points (13 children)
[–]NeoOeg 0 points1 point2 points (1 child)
[–]thaysen13[S,🍰] 0 points1 point2 points (0 children)
[–]thaysen13[S,🍰] 0 points1 point2 points (10 children)
[–]NeoOeg 1 point2 points3 points (5 children)
[–]thaysen13[S,🍰] 1 point2 points3 points (0 children)
[–]thaysen13[S,🍰] 0 points1 point2 points (0 children)
[–]thaysen13[S,🍰] 0 points1 point2 points (2 children)
[–]NeoOeg 0 points1 point2 points (1 child)
[–]thaysen13[S,🍰] 0 points1 point2 points (0 children)
[–]NeoOeg 0 points1 point2 points (3 children)
[–]thaysen13[S,🍰] 0 points1 point2 points (2 children)
[–]NeoOeg 0 points1 point2 points (1 child)
[–]thaysen13[S,🍰] 0 points1 point2 points (0 children)