liveBook · Manning

Container image

As explained in Quarkus in Action

A container image is a packaged filesystem and metadata bundle from which a container can be created and run.

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

How Quarkus in Action covers it

How deep it goes
Explains image variants, Dockerfile instructions, build commands, and runtime choices, but defers exhaustive container installation details.
Examples
Uses generated Dockerfiles, a native-micro image, Maven and Docker commands, image listing output, and a containerized native build.
What it assumes
Assumes a generated Quarkus application and basic Maven, Docker, or Podman use; teaches the available image Dockerfiles and native-build configuration.
What you can do after
Build and run a Quarkus container image with Docker or Podman, including an image based on a container-built native executable.
How it connects
Connects container images with Docker, Podman, Quarkus, native executables, Kubernetes, OpenShift, Docker Compose, registries, and serverless deployment.

Also explained in

Compare how 25 books explain container image →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Quarkus in Action. The section links point to the parts of the book it draws on.