A container image is an immutable package for an application, its runtime, filesystem, metadata, and startup configuration. Containers created from the image use a common format that can run across supported environments. section 18.3
For a Spring Boot application, the image can contain an executable JAR and a Java runtime. This makes it suitable for cloud platforms and Kubernetes, where the image becomes the deployable unit. section 18.1 section 18.3
Packaging a Spring Boot JAR
A Dockerfile can select an OpenJDK 11 runtime, locate the JAR in target/, copy it to app.jar, and configure java -jar /app.jar as the startup command. Building the Dockerfile produces a tagged image; running that image can publish the application on port 8080. section 18.3
FROM openjdk:11.0.12-jre
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
Shows the complete Dockerfile for turning a Maven-built executable JAR into a runnable image. section 18.3
Spring Boot can also build the image through Maven or Gradle with build-image or bootBuildImage. Image names can be supplied on the command line or configured in the build plugin, after which Docker can run or push the image.
























