How to deploy Spring Boot project with Docker

Docker in 1.idea install plug;

2. Create DockerFile, as follows.

# Base image using the Java 
the FROM the Java: 8 
# of 
MAINTAINER VIC < [email protected] > 
# VOLUME specifies the temporary directory is / tmp. 
# The effect is created under the host / var / lib / docker a temporary directory, and link to the container / tmp 
VOLUME / tmp 
# add the jar package to the vessel and renamed app.jar 
the ADD-es 1.0.0 app.jar -SNAPSHOT.jar 
# jar package running 
the rUN the bash -C 'Touch /app.jar' 
EntryPoint [ "Java", "- Djava.security.egd = File: / dev /./ urandom", "- jar" , "/ app.jar"]

3. es-1.0.0-SNAPSHOT.jar and DockerFile into a directory, the execution command generating docker mirror.

docker build -t es:1.0.0 -f DockerFile .

4. Review the current mirror docker images, and run-time image, start containers.

docker run -d -p 8081:8081 es:1.0.0

5. For the current into the container

docker exec -it containerId /bin/bash

6. Check the open ports

netstat -ntpl

7. View Log spring boot application

docker logs -f --tail=1000 containerId 

Guess you like

Origin www.cnblogs.com/TechSnail/p/12022761.html