From c968120c2e6baad54410a760aa7bac6e3c09e87b Mon Sep 17 00:00:00 2001 From: Michael Irwin Date: Thu, 4 Sep 2025 15:51:43 -0400 Subject: [PATCH 1/2] Couple of freshness updates to the Docker Concepts pages --- .../building-images/multi-stage-builds.md | 8 ++++---- .../building-images/using-the-build-cache.md | 16 ++++++++-------- .../building-images/writing-a-dockerfile.md | 10 ++++++---- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/content/get-started/docker-concepts/building-images/multi-stage-builds.md b/content/get-started/docker-concepts/building-images/multi-stage-builds.md index c6336879c21d..fd77fe5f3ee4 100644 --- a/content/get-started/docker-concepts/building-images/multi-stage-builds.md +++ b/content/get-started/docker-concepts/building-images/multi-stage-builds.md @@ -152,7 +152,7 @@ Now that you have the project, you’re ready to create the `Dockerfile`. 2. In the `Dockerfile`, define your base image by adding the following line: ```dockerfile - FROM eclipse-temurin:21.0.2_13-jdk-jammy + FROM eclipse-temurin:21.0.8_9-jdk-jammy ``` 3. Now, define the working directory by using the `WORKDIR` instruction. This will specify where future commands will run and the directory files will be copied inside the container image. @@ -190,7 +190,7 @@ Now that you have the project, you’re ready to create the `Dockerfile`. And with that, you should have the following Dockerfile: ```dockerfile - FROM eclipse-temurin:21.0.2_13-jdk-jammy + FROM eclipse-temurin:21.0.8_9-jdk-jammy WORKDIR /app COPY .mvn/ .mvn COPY mvnw pom.xml ./ @@ -268,7 +268,7 @@ Now that you have the project, you’re ready to create the `Dockerfile`. 1. Consider the following Dockerfile: ```dockerfile - FROM eclipse-temurin:21.0.2_13-jdk-jammy AS builder + FROM eclipse-temurin:21.0.8_9-jdk-jammy AS builder WORKDIR /opt/app COPY .mvn/ .mvn COPY mvnw pom.xml ./ @@ -276,7 +276,7 @@ Now that you have the project, you’re ready to create the `Dockerfile`. COPY ./src ./src RUN ./mvnw clean install - FROM eclipse-temurin:21.0.2_13-jre-jammy AS final + FROM eclipse-temurin:21.0.8_9-jre-jammy AS final WORKDIR /opt/app EXPOSE 8080 COPY --from=builder /opt/app/target/*.jar /opt/app/*.jar diff --git a/content/get-started/docker-concepts/building-images/using-the-build-cache.md b/content/get-started/docker-concepts/building-images/using-the-build-cache.md index bbe9a3282211..30aedaa10fec 100644 --- a/content/get-started/docker-concepts/building-images/using-the-build-cache.md +++ b/content/get-started/docker-concepts/building-images/using-the-build-cache.md @@ -22,7 +22,7 @@ Consider the following Dockerfile that you created for the [getting-started](./w ```dockerfile -FROM node:20-alpine +FROM node:22-alpine WORKDIR /app COPY . . RUN yarn install --production @@ -69,7 +69,7 @@ In this hands-on guide, you will learn how to use the Docker build cache effecti ```dockerfile - FROM node:20-alpine + FROM node:22-alpine WORKDIR /app COPY . . RUN yarn install --production @@ -144,7 +144,7 @@ In this hands-on guide, you will learn how to use the Docker build cache effecti 2 - Load metadata for docker.io/library/node:20-alpine + Load metadata for docker.io/library/node:22-alpine 2.7 seconds @@ -233,7 +233,7 @@ In this hands-on guide, you will learn how to use the Docker build cache effecti 6. Update the Dockerfile to copy in the `package.json` file first, install dependencies, and then copy everything else in. ```dockerfile - FROM node:20-alpine + FROM node:22-alpine WORKDIR /app COPY package.json yarn.lock ./ RUN yarn install --production @@ -262,10 +262,10 @@ In this hands-on guide, you will learn how to use the Docker build cache effecti => => transferring dockerfile: 175B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s - => [internal] load metadata for docker.io/library/node:21-alpine 0.0s + => [internal] load metadata for docker.io/library/node:22-alpine 0.0s => [internal] load build context 0.8s => => transferring context: 53.37MB 0.8s - => [1/5] FROM docker.io/library/node:21-alpine 0.0s + => [1/5] FROM docker.io/library/node:22-alpine 0.0s => CACHED [2/5] WORKDIR /app 0.0s => [3/5] COPY package.json yarn.lock ./ 0.2s => [4/5] RUN yarn install --production 14.0s @@ -295,10 +295,10 @@ In this hands-on guide, you will learn how to use the Docker build cache effecti => => transferring dockerfile: 37B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s - => [internal] load metadata for docker.io/library/node:21-alpine 0.0s + => [internal] load metadata for docker.io/library/node:22-alpine 0.0s => [internal] load build context 0.2s => => transferring context: 450.43kB 0.2s - => [1/5] FROM docker.io/library/node:21-alpine 0.0s + => [1/5] FROM docker.io/library/node:22-alpine 0.0s => CACHED [2/5] WORKDIR /app 0.0s => CACHED [3/5] COPY package.json yarn.lock ./ 0.0s => CACHED [4/5] RUN yarn install --production 0.0s diff --git a/content/get-started/docker-concepts/building-images/writing-a-dockerfile.md b/content/get-started/docker-concepts/building-images/writing-a-dockerfile.md index 38920c467493..e5710028100c 100644 --- a/content/get-started/docker-concepts/building-images/writing-a-dockerfile.md +++ b/content/get-started/docker-concepts/building-images/writing-a-dockerfile.md @@ -22,7 +22,7 @@ A Dockerfile is a text-based document that's used to create a container image. I As an example, the following Dockerfile would produce a ready-to-run Python application: ```dockerfile -FROM python:3.12 +FROM python:3.13 WORKDIR /usr/local/app # Install the application dependencies @@ -69,7 +69,9 @@ In this quick hands-on guide, you'll write a Dockerfile that builds a simple Nod ### Set up -[Download this ZIP file](https://github.com/docker/getting-started-todo-app/raw/build-image-from-scratch/app.zip) and extract the contents into a directory on your machine. +[Download this ZIP file](https://github.com/docker/getting-started-todo-app/archive/refs/heads/build-image-from-scratch.zip) and extract the contents into a directory on your machine. + +If you'd rather not download a ZIP file, clone the https://github.com/docker/getting-started-todo-app project and checkout the `build-image-from-scratch` branch. ### Creating the Dockerfile @@ -87,7 +89,7 @@ Now that you have the project, you’re ready to create the `Dockerfile`. 3. In the `Dockerfile`, define your base image by adding the following line: ```dockerfile - FROM node:20-alpine + FROM node:22-alpine ``` 4. Now, define the working directory by using the `WORKDIR` instruction. This will specify where future commands will run and the directory files will be copied inside the container image. @@ -117,7 +119,7 @@ Now that you have the project, you’re ready to create the `Dockerfile`. ```dockerfile - FROM node:20-alpine + FROM node:22-alpine WORKDIR /app COPY . . RUN yarn install --production From 4bb2e0fa537d254db442b05517f8417983539285 Mon Sep 17 00:00:00 2001 From: Michael Irwin Date: Thu, 4 Sep 2025 16:27:15 -0400 Subject: [PATCH 2/2] Format the build cache table a bit better --- .../building-images/using-the-build-cache.md | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/content/get-started/docker-concepts/building-images/using-the-build-cache.md b/content/get-started/docker-concepts/building-images/using-the-build-cache.md index 30aedaa10fec..2a00042bce7a 100644 --- a/content/get-started/docker-concepts/building-images/using-the-build-cache.md +++ b/content/get-started/docker-concepts/building-images/using-the-build-cache.md @@ -121,20 +121,23 @@ In this hands-on guide, you will learn how to use the Docker build cache effecti - - - - - - + + + + + + + + + - @@ -144,7 +147,7 @@ In this hands-on guide, you will learn how to use the Docker build cache effecti - @@ -154,7 +157,7 @@ In this hands-on guide, you will learn how to use the Docker build cache effecti - @@ -164,7 +167,7 @@ In this hands-on guide, you will learn how to use the Docker build cache effecti - @@ -176,7 +179,7 @@ In this hands-on guide, you will learn how to use the Docker build cache effecti - @@ -186,7 +189,7 @@ In this hands-on guide, you will learn how to use the Docker build cache effecti - @@ -196,7 +199,7 @@ In this hands-on guide, you will learn how to use the Docker build cache effecti - @@ -206,7 +209,7 @@ In this hands-on guide, you will learn how to use the Docker build cache effecti - @@ -216,13 +219,14 @@ In this hands-on guide, you will learn how to use the Docker build cache effecti - +
Steps - Description - Time Taken(1st Run) - Time Taken (2nd Run) -
Steps + Description + Time Taken (1st Run) + Time Taken (2nd Run) +
1 Load build definition from Dockerfile + Load build definition from Dockerfile 0.0 seconds
2 Load metadata for docker.io/library/node:22-alpine + Load metadata for docker.io/library/node:22-alpine 2.7 seconds
3 Load .dockerignore + Load .dockerignore 0.0 seconds
4 Load build context + Load build context

(Context size: 4.60MB)

5 Set the working directory (WORKDIR) + Set the working directory (WORKDIR) 0.1 seconds
6 Copy the local code into the container + Copy the local code into the container 0.0 seconds
7 Run yarn install --production + Run yarn install --production 10.0 seconds
8 Exporting layers + Exporting layers 2.2 seconds
9 Exporting the final image + Exporting the final image 3.0 seconds 0.0 seconds