스프링부트 컨테이너로 띄우기

(Spring Boot in a Container에서 넘어옴)

1 개요[ | ]

Spring Boot in a Container
도커 컨테이너로 스프링부트 띄우기

2 #[ | ]

root@ubuntu:~/HelloBoot# java -jar build/libs/demo-0.0.1-SNAPSHOT.jar

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.3.RELEASE)

2019-03-28 11:47:38.463  INFO 8843 --- [           main] com.example.demo.HelloBootApplication    : Starting HelloBootApplication on zeta1 with PID 8843 (/root/HelloBoot/build/libs/demo-0.0.1-SNAPSHOT.jar started by root in /root/HelloBoot)
2019-03-28 11:47:38.469  INFO 8843 --- [           main] com.example.demo.HelloBootApplication    : No active profile set, falling back to default profiles: default
2019-03-28 11:47:39.178  INFO 8843 --- [           main] com.example.demo.HelloBootApplication    : Started HelloBootApplication in 1.168 seconds (JVM running for 1.599)
HelloBoot!

3 #[ | ]

root@ubuntu01:~/HelloBoot# vi Dockerfile
FROM openjdk:8-jdk-alpine
VOLUME /tmp
COPY build/libs/demo-0.0.1-SNAPSHOT.jar app.jar
ENTRYPOINT ["java","-jar","/app.jar"]

4 #[ | ]

root@ubuntu01:~/HelloBoot# docker build -t hello-boot .
Sending build context to Docker daemon  7.848MB
Step 1/4 : FROM openjdk:8-jdk-alpine
 ---> e9ea51023687
Step 2/4 : VOLUME /tmp
 ---> Using cache
 ---> 55aa039bab9a
Step 3/4 : COPY build/libs/demo-0.0.1-SNAPSHOT.jar app.jar
 ---> 8ada506afb01
Step 4/4 : ENTRYPOINT ["java","-jar","/app.jar"]
 ---> Running in 3d35dd954bc9
Removing intermediate container 3d35dd954bc9
 ---> c285e856b38d
Successfully built c285e856b38d
Successfully tagged hello-boot:latest

5 #[ | ]

root@ubuntu01:~/HelloBoot# docker run -it --rm hello-boot

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.3.RELEASE)

2019-03-28 02:52:57.845  INFO 1 --- [           main] com.example.demo.HelloBootApplication    : Starting HelloBootApplication on d443a0838bed with PID 1 (/app.jar started by root in /)
2019-03-28 02:52:57.849  INFO 1 --- [           main] com.example.demo.HelloBootApplication    : No active profile set, falling back to default profiles: default
2019-03-28 02:52:58.815  INFO 1 --- [           main] com.example.demo.HelloBootApplication    : Started HelloBootApplication in 1.551 seconds (JVM running for 2.334)
HelloBoot!

6 같이 보기[ | ]

7 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}