Skip to content

Docker build cache broken after v24.0.7 when building "ltsc2019/1809" Windows container images on Windows 11 #47307

@pbering

Description

@pbering

Description

Docker Desktop 4.27.x was release which now comes with Docker Engine v25.0.2, previous version 4.26.1 came with Docker Engine v24.0.7.

Using Docker Engine v25.0.2 to build images based on ltsc2019/1809 Windows container images breaking the build cache and nothing is cache or it is never used.

Reproduce

Using this Dockerfile:

FROM mcr.microsoft.com/windows/nanoserver:ltsc2022

RUN echo "hello"

run docker image build . and you get expected first build output:

Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
 ---> e2547c7dd84d
Step 2/2 : RUN echo "hello"
 ---> Running in 7e39ef7bbc05
"hello"
 ---> Removed intermediate container 7e39ef7bbc05
 ---> b8baf9fb556c

run docker image build . again and you get expected build output where the RUN statement is cached:

Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
 ---> e2547c7dd84d
Step 2/2 : RUN echo "hello"
 ---> Using cache
 ---> b8baf9fb556c
Successfully built b8baf9fb556c

Now change the image to use ltsc2019:

FROM mcr.microsoft.com/windows/nanoserver:ltsc2019

RUN echo "hello"

run docker image build . and you get expected first build output:

Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM mcr.microsoft.com/windows/nanoserver:ltsc2019
 ---> 82ef3885248c
Step 2/2 : RUN echo "hello"
 ---> Running in 3c6de6846b97
"hello"
 ---> Removed intermediate container 3c6de6846b97
 ---> f55e40c44f69
Successfully built f55e40c44f69

run docker image build . yet again and now you can see the RUN statement is NOT CACHED:

Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM mcr.microsoft.com/windows/nanoserver:ltsc2019
 ---> 82ef3885248c
Step 2/2 : RUN echo "hello"
 ---> Running in 3c6de6846b97
"hello"
 ---> Removed intermediate container 3c6de6846b97
 ---> f55e40c44f69
Successfully built f55e40c44f69

Expected behavior

Building ltsc2019/1809 images should use the build cache as it did before on v24.0.7.

docker version

failed to get console mode for stdout: The handle is invalid.
Client:
 Cloud integration: v1.0.35+desktop.10
 Version:           25.0.2
 API version:       1.44
 Go version:        go1.21.6
 Git commit:        29cf629
 Built:             Thu Feb  1 00:24:09 2024
 OS/Arch:           windows/amd64
 Context:           default

Server: Docker Desktop 4.27.1 (136059)
 Engine:
  Version:          25.0.2
  API version:      1.44 (minimum version 1.24)
  Go version:       go1.21.6
  Git commit:       fce6e0c
  Built:            Thu Feb  1 00:23:01 2024
  OS/Arch:          windows/amd64
  Experimental:     false

docker info

failed to get console mode for stdout: The handle is invalid.
Client:
 Version:    25.0.2
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.12.1-desktop.4
    Path:     C:\Program Files\Docker\cli-plugins\docker-buildx.exe
  compose: Docker Compose (Docker Inc.)
    Version:  v2.24.3-desktop.1
    Path:     C:\Program Files\Docker\cli-plugins\docker-compose.exe
  debug: Get a shell into any image or container. (Docker Inc.)
    Version:  0.0.22
    Path:     C:\Program Files\Docker\cli-plugins\docker-debug.exe
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-dev.exe
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.21
    Path:     C:\Program Files\Docker\cli-plugins\docker-extension.exe
  feedback: Provide feedback, right in your terminal! (Docker Inc.)
    Version:  v1.0.4
    Path:     C:\Program Files\Docker\cli-plugins\docker-feedback.exe
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.0.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-init.exe
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-sbom.exe
  scout: Docker Scout (Docker Inc.)
    Version:  v1.3.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-scout.exe

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 970
 Server Version: 25.0.2
 Storage Driver: windowsfilter
  Windows: 
 Logging Driver: json-file
 Plugins:
  Volume: local
  Network: ics internal l2bridge l2tunnel nat null overlay private transparent
  Log: awslogs etwlogs fluentd gcplogs gelf json-file local splunk syslog
 Swarm: inactive
 Default Isolation: hyperv
 Kernel Version: 10.0 22631 (22621.1.amd64fre.ni_release.220506-1250)
 Operating System: Microsoft Windows Version 23H2 (OS Build 22631.3085)
 OSType: windows
 Architecture: x86_64
 CPUs: 24
 Total Memory: 63.91GiB
 Name: amd
 ID: d27c76ac-01ee-4ca5-b776-e0a90411f084
 Docker Root Dir: D:\Data\Docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

Additional Info

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions