All Questions
Tagged with spring-boot docker
2,945
questions
67
votes
7
answers
165k
views
Externalising Spring Boot properties when deploying to Docker
In my Spring Boot app I want to externalise the properties to run in a Docker container. When first deployed, the properties that are currently in my-server/src/main/resources/application.yml are ...
64
votes
3
answers
119k
views
Deploying Java webapp to Tomcat 8 running in Docker container
I am pretty new to Tomcat and Docker - so I am probably missing a Tomcat fundamental somewhere in this question.
What I am trying to do is build a Docker container that runs a SpringBoot Restful web ...
48
votes
2
answers
57k
views
How can I start spring boot application in docker with profile?
I have a simple spring-boot project:
-resources
-application.yaml
-application-test.yaml
And I have this Dockerfile:
FROM openjdk:8-jdk-alpine
EXPOSE 8080
ADD micro-boot.jar micro-boot.jar
...
28
votes
3
answers
67k
views
Docker WARNING: Published ports are discarded when using host network mode
I have a Springboot app that I have Dockerized.
I have it exposed on port 8081, and can access it as expected.
http://<ipaddress>:8081
Problem
The Springboot app in the docker container needs ...
27
votes
4
answers
9k
views
Should each Docker image contain a JDK?
So, I'm very new to Docker. Let me explain the context to the question.
I have 10 - 20 Spring Boot micro-service applications, each running on different ports on my local machine.
But for migrating ...
26
votes
2
answers
11k
views
Spring Boot & Docker using VOLUME /tmp
Is anyone able to explain why the Spring Boot Docker Guide recommends adding the /tmp volume as follows:
VOLUME /tmp
It explains:
We added a VOLUME pointing to "/tmp" because that is where ...
25
votes
3
answers
37k
views
Docker run -p ?/? (what are this two port numbers and what they represents )
I used command "docker run -p 8080/8080 --name my_local_image ...." and it failed saying Unable to find image '8080/8080:latest' locally
8080/8080 = what this two port represents exactly ?
21
votes
2
answers
5k
views
Use Eureka despite having random external port of docker containers
I am writing an application that is composed of a few spring boot based microservices with a zuul based reverse proxy in the front-
It works when I start the services on my machine, but for server ...
20
votes
5
answers
26k
views
How to do a health check of a Spring Boot application running in a Docker Container?
I am running a Spring Boot application within a Docker container, using the Docker file to start the application within the container. How can I check the health of the Spring Boot application within ...
20
votes
6
answers
57k
views
How to pass Java options/variables to Springboot app in docker run command
I have a Spring Boot application which uses profiles to configure in different environments. I want to pass this profile information as a parameter to my docker run command. How do I go about doing it?...
20
votes
5
answers
25k
views
debug spring-boot in docker
For some reason I have issues connecting remote debug to a spring-boot app running inside docker. I start the java app with:
java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n ...
19
votes
4
answers
23k
views
ElasticSearch health check failed every time when spring boot start up
I am working with Elastic Search 5.5.0 on Spring boot 1.5.8.RELEASE using the Java Transport Client library.
The Elastic Search was deployed with docker in a container. It works well. The queries ...
19
votes
2
answers
46k
views
Passing env variables to DOCKER Spring Boot
I have a SpringBoot application and its Dockerfile is as follows. I have application.properties for different environments like local/dev/qa/prod. When I run the application locally in IDE, I pass -...
19
votes
3
answers
8k
views
sending udp broadcast from a docker container
I'm having a few docker containers (Using docker-compose and a single network - network-sol)
One of the containers is a Spring Boot application that sends UDP broadcast to the local network. 255.255....
18
votes
2
answers
14k
views
Spring-boot application won't boot at startup inside docker
I am running a simple spring-boot application inside a docker container. At startup whether started with java -jar MY_JAR.jar or mvn spring-boot:run the application will always hang at the following ...
18
votes
3
answers
33k
views
How to install and run wkhtmltopdf Docker image
I want to install and run wkhtmltopdf from Dockerfile of Spring-Boot application when I will build and run the Spring-boot application.
I have written the below given scripts in Dockerfile to install ...
17
votes
1
answer
13k
views
Increase startup timeout for Azure WebApp for Containers
We run Java Spring Boot app in a Docker on Azure WebApp for Containers. Single B1 instance is enough for the app to run, however Spring Boot is pretty slow at startup and might take over 240 seconds ...
17
votes
7
answers
47k
views
Communications link failure , Spring Boot + MySql +Docker + Hibernate
I'm working with spring boot, hibernate & MySql. While running the application it is running well as per expectation . But while making the docker-compose file and running the app docker image ...
16
votes
2
answers
43k
views
Making a REST Call to Endpoint in Dockers
I am building a Spring Boot application, which has a few different REST endpoints. It can be locally packaged and launched as a jar file successfully. When running locally, I can access its endpoints ...
16
votes
9
answers
11k
views
Why do I have ' Builder lifecycle 'creator' failed with status code 51' when I run 'mvn spring-boot:build-image'
I'm learning Docker and I'm trying to create an Image of my current Spring project.
I'm trying to run mvn spring-boot:build-image to create a docker image for my Spring Boot project, but I got this ...
14
votes
3
answers
14k
views
Run SpringBoot-based docker image return error message:Invalid or corrupt jarfile /app.jar
I followed the Spring official tutorial(https://spring.io/guides/gs/spring-boot-docker/) to build springBoot-based app to docker image. The docker image was built successfully, but when I wanted to ...
14
votes
1
answer
7k
views
Keycloak and Spring Boot web app in dockerized environment
Consider the following environment:
one docker container is keycloak
another docker container is our web app that uses keycloak for authentication
The web app is a Spring Boot application with "...
13
votes
1
answer
22k
views
How to init MySql Database in Docker Compose
Scenario:
I developed a microservice in Spring which uses a mysql 8 database.
This db has to be initalized (create a Database, some tables and data).
On my host machine I initialized the database with ...
13
votes
7
answers
27k
views
Maven error occurred in starting fork, check output in log
I use Maven, docker-maven-plugin and Spring Boot. Right now I run into the following issue:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] ...
13
votes
4
answers
5k
views
Spring Config server not reachable with docker-compose until client is restarted
I have a 'discovery first' setup with Eureka, Config Server, and my client.
The issue is that these 3 services start in order, but the client-server seems to register too early, and can never find ...
13
votes
2
answers
8k
views
Why does wildcard for jar execution not work in docker CMD?
I have a Dockerfile with the following CMD to start my spring boot app:
FROM java:8-jre
# ...
CMD ["java", "-jar", "/app/file*.jar"]
When I try to start a container from the created image I get:
...
13
votes
1
answer
10k
views
Spring Boot containers can not connect to the Kafka container
I'm trying to use microservices Spring Boot with Kafka, but my Spring Boot containers can not connect to the Kafka container.
docker-compose.yml:
version: '3'
services:
zookeeper:
image: ...
13
votes
1
answer
7k
views
Docker with "--network host" does not allow to access to port of application
I have Spring Boot app inside docker and I am running my app like this:
docker run --rm --network host --name myapp1 myapp
But when i am trying to access it from host machine it fails:
my_machine:~ ...
13
votes
2
answers
11k
views
How to auto reload spring boot application in docker using spring dev tools
I followed this link to deploy my application into local docker directly and debug it.
I was able to deploy and debug but auto reload was not working for me
Can you help me with auto reload for ...
13
votes
1
answer
9k
views
IntelliJ Idea: build and run Java apps in docker containers
In my project I'd like to containerize my Spring Boot applications not only on production environment but also locally. In order to do that I'd like to:
Start docker container (from a java image)
...
12
votes
3
answers
64k
views
Spring Kafka SSL setup in Spring boot application.yml
I am trying to setup a Spring Boot Application with a Kafka Client to use SSL.
I have my keystore.jks and truststore.jks stored on a filesystem(on a docker container) because of this: https://github....
12
votes
3
answers
18k
views
No plugin found for prefix 'docker' in the current project and in the plugin groups
deploy Spring Cloud project with docker, some code in the pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
...
12
votes
5
answers
36k
views
Getting MongoCommandException: Command failed with error 18 (AuthenticationFailed): 'Authentication failed.' on server localhost:27017
I want to establish a connection with my MongoDB database running in docker. Application seemingly starts without any problem but when I am trying to call any request like simple GET:
localhost:8082/...
12
votes
1
answer
9k
views
docker repository name component must match
I am trying to build my image using this plugin: https://github.com/spotify/docker-maven-plugin#use-a-dockerfile
When I run mvn clean package docker:build
I get this error:
[ERROR] Failed to ...
12
votes
4
answers
12k
views
Spring Boot + docker-compose + MySQL: Connection refused
I'm trying to set up a Spring Boot application that depends on a MySQL database called teste in docker-compose. After issuing docker-compose up, I'm getting:
Caused by: java.net.ConnectException: ...
12
votes
1
answer
7k
views
Failed to bind properties under 'server.port' to java.lang.Integer
Some time ago I faced with such issue:
Failed to bind properties under 'server.port' to java.lang.Integer:
Property: server.port
Value: $PORT
Origin: "server.port" from property ...
11
votes
3
answers
5k
views
What is the difference between spring-boot:build-image vs jib?
Spring Boot 2.3.x adds the capability of building a Docker image using their plugin via spring-boot:build-image. Jib seems to allow the same functionality but is not limited to Spring boot.
Is there ...
11
votes
5
answers
19k
views
IllegalStateException: Topic(s) [XYZ] is/are not present and missingTopicsFatal is true
I have a Spring Boot app that tries to read from a local Kafka topic.
The app starts to spin up, pauses for 2 minutes and throws the following error:
19-11-10 14:49:24.700 INFO 20476 --- [ ...
11
votes
7
answers
12k
views
spring boot cloud eurka windows 10 eurkea returns host.docker.internal for client host name after latest docker upgrade
Spring Boot Cloud Disovery Question, Problem with Eureka hostname after docker upgrade on windows 10. (Note: docker is not hosting spring services, just mariadb, rabbitmq, and zipkin)
Summary
I am ...
11
votes
2
answers
19k
views
Pass command line args to Java app (Spring Boot) running in Docker
I'm trying to pass command line args to the main method of a Spring Boot app running in a Docker container. Running from the command line, I would do something like this:
$ mvn spring-boot:run -...
11
votes
3
answers
4k
views
Builder lifecycle 'creator' failed with status code 51
In my spring boot application i issue a problem when i 'm trying to build my docker image by this command
mvn spring-boot:build-image -DskipTests
i see as a result a build failure:
[INFO] Scanning ...
11
votes
4
answers
36k
views
Kubernetes Pod terminates with Exit Code 143
I am using a containerized Spring boot application in Kubernetes. But the application automatically exits and restarts with exit code 143 and error message "Error".
I am not sure how to ...
11
votes
3
answers
4k
views
How to add extra linux dependencies into a spring-boot buildpack image?
I updated my spring-boot application to use buildpacks to create my docker-image instead of a dockerfile. I also use Apache POI in my application and since that update I get an error when generating ...
11
votes
1
answer
3k
views
Spring Cloud Samples Eureka - Docker - Use of underscore in link
I may have encountered an interesting anomaly with the use of Spring Cloud, Eureka and Docker. I am not sure if I have uncovered an issue or if the behavior is expected, but here is the gist.
I ...
11
votes
2
answers
14k
views
Spring Boot in Docker
I am learning how to use Docker with a Spring Boot app. I have run into a small snag and I hope someone can see the issue. My application relies heavily on @Value that are set in environment ...
11
votes
2
answers
5k
views
is it a good practice to put a war file image into docker containers?
I am new to docker. I have a Spring-boot application which I want to deploy and run using docker. Is it a good practice to put war file images in the container or it is better to put jar ones? why?
P....
11
votes
2
answers
18k
views
How to resolve org.testcontainers.containers.ContainerFetchException on Spring Boot?
I am working on developing a few integration tests for my spring boot application. I am using testcontainers in order to create a MongoDB docker image. My code so far:
ContainerListener.java class:
...
10
votes
4
answers
11k
views
How to set JVM arguments when running mvn spring-boot:build-image command in Spring Boot 2.3.0 to generate a docker image?
I am trying to build a docker image using the latest version of Spring Boot (2.3.0) . All I have to create an image now is run the command mvn:spring-boot:build-image . This will create a docker image ...
10
votes
2
answers
9k
views
java.net.UnknownHostException dockerized mysql from spring boot application
I have a spring boot application and dockerized mysql db.
My docker container is up and result of docker ps command below.
cf7936857c6f mysql:5.6 "docker-entrypoint.s…" 7 ...
10
votes
2
answers
6k
views
Redeploy spring-boot application in docker container?
I have a spring-boot project and I want automatically redeploy my jar in the container.
How to do it correctly?
So far, all I see is this way. It's the right way?
# cd /home/jdev;
# sudo docker ...