I have a little problem starting my spring boot application in docker.
stack: maven 3+, spring boot (jpa / rest / jetty) - mysql - docker deployment
So, I have pom in my file
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.4.0.M3</version> <relativePath/> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-rest</artifactId> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jetty</artifactId> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>javax.el</groupId> <artifactId>javax.el-api</artifactId> <version>3.0.0</version> </dependency> <dependency> <groupId>com.google.http-client</groupId> <artifactId>google-http-client</artifactId> <version>1.21.0</version> </dependency> <dependency> <groupId>com.google.http-client</groupId> <artifactId>google-http-client-jackson2</artifactId> <version>1.21.0</version> </dependency> </dependencies>
Environment: Ubuntu 16.04 x64 Problem: Locally: I'm trying to start my application using the following command in terminal
user$ java -Xmx768m -jar /mnf-backend.jar --spring.datasource.url=jdbc:mysql://$MYSQL_PORT_3306_TCP_ADDR/app_1?autoReconnect=true&useSSL=false user$
This is not good, I can endure it. But not a docker. When the commands above will be launched in the docker, then the container will stop the docker (because → the application exit with status 1)
ENTRYPOINT ["java", "-Xmx768m", "-jar", "/mnf-backend.jar", "--spring.datasource.url=jdbc:mysql://$MYSQL_PORT_3306_TCP_ADDR/app_1?autoReconnect=true&useSSL=false"]
Docker will start the container for 1 second and stop the container immediately because the return control is java. I am looking for a method that allows me to customize the spring application for predictable behavior or any ideas for improving my docker instructions. my content docker file:
FROM frolvlad/alpine-oraclejdk8:slim ENV MNFB_ENV production ENV SERVER_PORT 9000 ADD ./builds/mnf-latest.jar mnf-backend.jar EXPOSE 9000 ENTRYPOINT ["java", "-Xmx768m", "-jar", "/mnf-backend.jar", "--spring.datasource.url=jdbc:mysql://$MYSQL_PORT_3306_TCP_ADDR/minifinance?autoReconnect=true&useSSL=false"]
docker container logs 
For example: when I started nodejs host control, do not return until the application ends
user$ node ./server.js [...here program output and stdout strings] [... it may be stopped by ctrl+c for example]