- Create a Spring Boot App
- Run and verify the working of the App
- Include the following build plugin details in POM file to create the docker image<plugin><groupId>com.spotify</groupId><artifactId>docker-maven-plugin</artifactId><configuration><imageName>hellodocker</imageName><baseImage>java:8</baseImage><entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint><resources><resource><targetPath>/</targetPath><directory>${project.build.directory}</directory><include>${project.build.finalName}.jar</include></resource></resources></configuration></plugin>
- To create the docker image ,use the maven build and in the configuration specify docker:build
- The required files are downloaded and then docker file and image are created in /target/docker
- From the docker console chech if the image is created using the command docker images
- Start the container using the image on Port 9090 with the following command
- docker run -it -p 9090:8080 <
> - Verify the working of using the URL http://localhost:9090/hello
- Start another container on port 9091
- docker run -it -p 9091:8080 <
> - Verify the working of 2nd Container using the URL http://localhost:9091/hello
Books
12 years ago
No comments:
Post a Comment