docker for java app

Table of Contents
  • write a Dockerfile

    FROM openjdk:21
    COPY target/reminder.jar /usr/src/reminder
    WORKDIR /usr/src/reminder
    EXPOSE 8080
    CMD ["java" ,"-jar", "reminder.jar" ]
  • build image

docker build --t reminder:1.0.0 .
docker run -it -p 18080:8080 reminder:1.0.0
  • use cloud native buildpacks to build open container initiative(OCI)
./mvnw spring-boot:build-image

Comments |0|

Legend *) Required fields are marked
**) You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
Category: 似水流年