spring-boot cannot start in docker spring-boot cannot start in docker shell shell

spring-boot cannot start in docker


I think the problem is the ampersand (&) in your command line:

--spring.datasource.url=jdbc:mysql://$MYSQL_PORT_3306_TCP_ADDR/app_1?autoReconnect=true&useSSL=false"]

Try to escape it:

--spring.datasource.url=jdbc:mysql://$MYSQL_PORT_3306_TCP_ADDR/app_1?autoReconnect=true\&useSSL=false"]

The ampersand denotes the shell to start your process in the background. That's exactly what's happening on your local machine. If you start your jar, the process should start in foreground... and the prompt shouldn't return directly.


To keep it simple and clean, we have added database properties in the database.properties

mongo db database configuration

spring.data.mongodb.database=abc-authspring.data.mongodb.host=192.168.2.2spring.data.mongodb.port=27017spring.data.mongodb.password=abc234quthspring.data.mongodb.username=abc-auth

We push this file while running the Docker, so only database properties will get override with the existing application.properties

ENTRYPOINT ["java","-jar","/home/docker/service/abc.jar","--spring.config.location=application.properties"]