A container image packages an application with the filesystem and metadata required to create and run a container. In cloud-native development, it provides a deployable form for Quarkus services and can be built with Docker or Podman. section 2.6 section 11.7
Quarkus can generate Dockerfiles for several packaging formats, but a Dockerfile is only one image-building route. Quarkus extensions can also create and deploy images for cloud platforms. section 2.6 section 2.0
The generated Dockerfiles target these application forms:
- JVM fast JAR, the default JVM format. section 2.6
- Legacy JAR, the earlier JVM packaging format. section 2.6
- Native executable, packaged for a container without a JVM. section 2.6
- Native executable with a Quarkus-tuned micro base image, reducing the resulting image size. section 2.6
Listing 2.17 Dockerfile.native-micro Dockerfile
####
# This Dockerfile is used in order to build a container that runs the
# Quarkus application in native (no JVM) mode.
# It uses a micro base image, tuned for Quarkus native executables.
# It reduces the size of the resulting container image.
# Check https://quarkus.io/guides/quarkus-runtime-base-image for further
# information about this image.
#
# Before building the container image run:
#
# ./mvnw package -Dnative #1
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.native-micro
# -t quarkus/quarkus-in-action . #2
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080
# quarkus/quarkus-in-action #3
#
###
FROM quay.io/quarkus/quarkus-micro-image:2.0 #4
WORKDIR /work/
RUN chown 1001 /work \
&& chmod "g+rwX" /work \
&& chown 1001:root /work
COPY --chown=1001:root target/*-runner /work/application
EXPOSE 8080
USER 1001
ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"]
Shows the complete native-micro workflow: build the native application, build the image from its Dockerfile, and run the container with port mapping. section 2.6
Building a native image through a container
A native executable can be built inside a Docker or Podman container when GraalVM or Mandrel is unavailable. Set quarkus.native.container-build=true; Quarkus detects the runtime or accepts an explicit Docker or Podman setting. The resulting Linux-specific executable can then be packaged into a container image. section 2.4.5
























