Assuming demo is the project name and navigated into demo folder:
===========================================
mvnw package ==> to build project
docker build -t demo . ==> to create image
docker image ls
docker run -p 5000:8080 demo ==> to run image
==========================================
Access instance using : http://localhost:5000/
==========================================
Remove Docker containers and images:
-----------------------------------------------
docker container ls
docker stop <container_id> ==> To stop container
docker rm <container_id> ==> to remove container
docker images -a
docker rmi <all image_ids> ==> to remove image
===========================================
Dockerfile (no extension)
FROM openjdk:8-jdk-alpine VOLUME C:\\temp ARG JAR_FILE=target/demo-0.0.1-SNAPSHOT.jar EXPOSE 8080 ADD ${JAR_FILE} app.jar ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
mvnw package ==> to build project
docker build -t demo . ==> to create image
docker image ls
docker run -p 5000:8080 demo ==> to run image
==========================================
Access instance using : http://localhost:5000/
==========================================
Remove Docker containers and images:
-----------------------------------------------
docker container ls
docker stop <container_id> ==> To stop container
docker rm <container_id> ==> to remove container
docker images -a
docker rmi <all image_ids> ==> to remove image