beginnerDockerfile Instructions & Multi-Stage Builds

How would you pass a different JAR file name into the build without editing the Dockerfile?

Declare an ARG with a default, e.g., ARG JAR_FILE=target/*.jar, then reference it in COPY: COPY ${JAR_FILE} app.jar. At build time, override it with docker build --build-arg JAR_FILE=target/myapp-2.0.jar . — useful for CI pipelines that build multiple variants from one Dockerfile.

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full DevOps Mastery library.

How would you pass a different JAR file name into the build without editing the Dockerfile?

Next Step

Continue to What does HEALTHCHECK do, and how does Docker use the result?← Back to all Docker questions