liveBook · Manning

Dockerfile

As explained in Quarkus in Action

A Dockerfile is a text-based build specification containing instructions for creating a Docker container image.

A Dockerfile is a text-based build specification for creating a container image. Quarkus generates Dockerfiles because packaging applications into Docker or Podman images is a common cloud deployment task. The generated files are useful when a Dockerfile is required, although Quarkus extensions can provide other image-building and deployment approaches. section 2.6

A generated Quarkus project places Dockerfiles in src/main/docker for several packaging modes:

  • Dockerfile.jvm packages the application in JVM fast-JAR mode, the default format. section 2.6
  • Dockerfile.legacy-jar packages the application in the older JVM legacy-JAR format. section 2.6
  • Dockerfile.native packages a Quarkus native executable. section 2.6
  • Dockerfile.native-micro packages a native executable with a Quarkus-tuned micro base image to reduce the resulting image size. section 2.6

Build and run a native-micro image

Build the native application first with ./mvnw package -Dnative. Then build the image with docker build -f src/main/docker/Dockerfile.native-micro -t quarkus/quarkus-in-action ., and run it with docker run -i --rm -p 8080:8080 quarkus/quarkus-in-action. The Dockerfile uses quay.io/quarkus/quarkus-micro-image:2.0 as its base, sets /work as the working directory, and configures ownership and permissions for the application files.

How Quarkus in Action covers it

How deep it goes
Explains generated variants and demonstrates one build and run workflow, without covering Dockerfile instructions exhaustively.
Examples
Uses generated JVM, legacy-JAR, native, and native-micro files plus a complete native-micro build-and-run listing.
What it assumes
Assumes a generated Quarkus application, a native build, and access to Docker or Podman commands.
What you can do after
Builds and runs a Quarkus native container image with Maven, Docker build, and Docker run commands.
How it connects
Connects Dockerfiles with Quarkus packaging, Maven builds, native executables, Docker images, containers, and micro base images.

Also explained in

Compare how 18 books explain Dockerfile →

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.