microsoft / microsoft/vscode-remote-release

DevContainer buildx re-pulls image although it already exists on the host

Open
#11,037 2 comments 0 reactions 1 assignee View on GitHub

@chrmarti is already working on this.

Since Jun 23, 2025.

bug containers
Dominant language
Dockerfile
Stars
4.2k
Forks
469
Avg merge
1d 1h
Merged PRs (30d)
1

Description

  • VSCode Version: 1.101.1
  • Local OS Version: Win 11
  • Remote OS Version:
  • Remote Extension/Connection Type: Dev Containers/WSL/Remote - Tunnels/VS Code Server

Every time I rebuild (with or without cache makes no difference) my devcontainer, it pulls all layers of a large docker image again, although docker on my desktop (using Podman Desktop and the Docker compatibility mode) confirms, the image is up to date.

docker pull <my-docker-repo>5-add-polyspace-platform/polyspace:f7cb4fccfe234aaada41543cd16d9a525355be78
b815984ef5af: Already exists
d18de2d57be4: Already exists
4f8983bf0e70: Already exists
6a2531b72d37: Already exists
29b1cc280302: Already exists
19ffb1766630: Already exists
9cdc993505fe: Already exists
d1c45613890f: Already exists
1a38540e491c: Already exists
f90c8eb4724c: Already exists
27a9245833c9: Already exists
455dc6c25f1a: Already exists
59b59c5ba3cc: Already exists
d4e93011809f: Already exists
01a40bec1cb2: Already exists
4f4fb700ef54: Already exists
8ed2c377c09c: Already exists
81c94d6faddf: Already exists
75b2768492d5: Already exists
eb6973bf34a0: Already exists
ca350c38697d: Already exists
a75096340bd0: Already exists
9282d8301856: Already exists
9839e6757baa: Already exists
e5a3dba6df33: Already exists
1fc177a93b61: Already exists
a6b7995f95fd: Already exists
d0d18580a9fe: Already exists
4a5aadc57a73: Already exists
0f77a7aa5515: Already exists
48fb287b0c80: Already exists
2f0c8d1ff166: Already exists
16a27ed27244: Already exists
e06b1bcf5dd7: Already exists
bd68d458afd8: Already exists
093c52f5a0b7: Already exists
d63142f2d971: Already exists
2aa362e93858: Already exists
3c2c500407e9: Already exists
29372f6756f2: Already exists
98fc8231b894: Already exists
29083a573053: Download complete
<my-docker-repo>5-add-polyspace-platform/polyspace:f7cb4fccfe234aaada41543cd16d9a525355be78

When rebuilding the devcontainer, with this config:

{
    "name": "Zephyr Embedded Development Demo Project",
    "build": {
        "dockerfile": "Dockerfile",
        "args": {"DEVCONTAINER_USER": "${localEnv:USERNAME}"}
    },
    
    "mounts": [
        "type=bind,source=/mnt/wslg/.X11-unix,target=/tmp/.X11-unix",
        "type=bind,source=${localEnv:HOME}${localEnv:USERPROFILE}/xchange,target=/tmp/xchange"
    ],
    "remoteUser": "${localEnv:USERNAME}"
}

and this Dockerfile

# Wrapper to create the windows user inside the container
FROM<my-docker-repo>5-add-polyspace-platform/polyspace:f7cb4fccfe234aaada41543cd16d9a525355be78

USER root

ARG DEVCONTAINER_USER=user
RUN echo $DEVCONTAINER_USER
COPY fix_user.sh /tmp/fix_user.sh
RUN chmod +x /tmp/fix_user.sh && /tmp/fix_user.sh $DEVCONTAINER_USER

USER ${DEVCONTAINER_USER}

ENV TERM=xterm-256color
CMD ["bash", "-l"]
SHELL ["bash", "-l"]
ENTRYPOINT [ "" ]

Pulls everything again, why?

[10552 ms] @devcontainers/cli 0.77.0. Node.js v20.15.1. linux 5.15.167.4-microsoft-standard-WSL2 x64.
[10552 ms] Start: Run: docker buildx version
[10625 ms] Stop (73 ms): Run: docker buildx version
[10625 ms] github.com/docker/buildx v0.14.0 171fcbeb69d67c90ba7f44f41a9e418f6a6ec1da
[10626 ms] 
[10626 ms] Start: Run: docker -v
[10636 ms] Stop (10 ms): Run: docker -v
[10636 ms] Start: Resolving Remote
[10640 ms] Start: Run: git rev-parse --show-cdup
[10642 ms] Stop (2 ms): Run: git rev-parse --show-cdup
[11439 ms] Start: Run: docker ps -q -a --filter label=vsch.local.repository=<my-git-repo>.git --filter label=vsch.local.repository.volume=vsc-remote-containers --filter label=vsch.local.repository.folder=zephyr-demo-project --filter label=devcontainer.config_file=/workspaces/zephyr-demo-project/.devcontainer/devcontainer.json
[11458 ms] Stop (19 ms): Run: docker ps -q -a --filter label=vsch.local.repository=<my-git-repo>.git --filter label=vsch.local.repository.volume=vsc-remote-containers --filter label=vsch.local.repository.folder=zephyr-demo-project --filter label=devcontainer.config_file=/workspaces/zephyr-demo-project/.devcontainer/devcontainer.json
[11462 ms] Start: Run: docker inspect --type image <my-docker-repo>5-add-polyspace-platform/polyspace:f7cb4fccfe234aaada41543cd16d9a525355be78
[11489 ms] Stop (27 ms): Run: docker inspect --type image <my-docker-repo>5-add-polyspace-platform/polyspace:f7cb4fccfe234aaada41543cd16d9a525355be78
[11492 ms] workspace root: /workspaces/zephyr-demo-project
[11492 ms] No user features to update
[11494 ms] Start: Run: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-root/container-features/0.77.0-1750700121480/Dockerfile-with-features -t vsc-zephyr-demo-project-ef37398b43aa503131e5aab09377f6a7b427da4781019c7752aec70cb26110ba --target dev_containers_target_stage --no-cache --pull --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label /workspaces/zephyr-demo-project/.devcontainer
[+] Building 0.0s (0/1)                                docker-container:default
[+] Building 1.2s (6/10)                               docker-container:default.
 => [internal] load build context                                          0.0s
 => => transferring context: 1.10kB                                        0.0s
 => [dev_container_auto_added_stage_label 1/4] FROM <my-docker-repo>  386.2s
 => => resolve <my->  0.0s
 => => sha256:bd68d458afd82828a5bd65aac9de16a556b937d6bc2f9ca 533B / 533B  0.2s
[+] Building 1.4s (6/10)                               docker-container:default
 => [internal] load build context                                          0.0s
 => => transferring context: 1.10kB                                        0.0s
 => [dev_container_auto_added_stage_label 1/4] FROM <my-docker-repo>  386.4s
 => => resolve <my->  0.0s
 => => sha256:bd68d458afd82828a5bd65aac9de16a556b937d6bc2f9ca 533B / 533B  0.2s
[+] Building 1.5s (6/10)                               docker-container:default
 => [internal] load build context                                          0.0s
 => => transferring context: 1.10kB                                        0.0s
 => [dev_container_auto_added_stage_label 1/4] FROM <my-docker-repo>  386.5s
 => => resolve <my->  0.0s
 => => sha256:bd68d458afd82828a5bd65aac9de16a556b937d6bc2f9ca 533B / 533B  0.2s
 => => sha256:bd68d458afd82828a5bd65aac9de16a556b937d6bc2f9ca 533B / 533B  0.2s
 => => sha256:3c2c500407e9018cdffdeb1dba1f2eb844859d06317d7d0 188B / 188B  0.2s
 => => sha256:29372f6756f20951de24c099aa21bf071a117205 1.36GB / 1.57GB  1175.9s
 => => sha256:d63142f2d9716ce9e128385eb3d43f9dfa7de88c 73.19MB / 73.19MB  66.3s
 => => sha256:2aa362e9385809116782c0f195fdb904127886f1 1.39GB / 1.76GB  1175.7s
 => => sha256:98fc8231b894103cb6f51470af9acb33e9e1e037 1.28GB / 1.57GB  1175.9s
 => => sha256:16a27ed2724425770a0f4a111a255f18ac24f 148.54MB / 148.54MB  131.4s
 => => sha256:4a5aadc57a7359efba22c03c01bb0afde6b9dd1 866.64kB / 866.64kB  1.2s
 => => sha256:a6b7995f95fd2f86df71495dbc4ba99f96a93f26b112a73 132B / 132B  0.0s
 => => sha256:e06b1bcf5dd794c653c5c483dc96a6d1e8d46212183b63c 221B / 221B  0.0s
 => => sha256:2f0c8d1ff1665978d6722ca168169f760b44d3da21b 2.58kB / 2.58kB  0.0s
 => => sha256:48fb287b0c806aa7e28fb32f02ce9034d55891778e51b49 181B / 181B  0.0s
 => => sha256:e5a3dba6df331b30b28d2815b86a9a96bdd045b7b32a8bd 214B / 214B  0.0s
 => => sha256:9282d83018564db32197c31dea8e5a0649851a5752f546c 323B / 323B  0.0s
 => => sha256:093c52f5a0b79ecca30246c41169d2568be71c07beb1eaf 315B / 315B  0.0s
 => => sha256:0f77a7aa5515b4aa1865a9f82bfb33fb60286f69 53.22MB / 53.22MB  50.4s
 => => sha256:d0d18580a9fefc1c022342865e1e34931d41201b731bfcf 313B / 313B  0.0s
 => => sha256:9839e6757baaed99b19b6a04ec3d5bddb7a02 711.26MB / 711.26MB  598.1s
 => => sha256:eb6973bf34a052d0b5b4c61150ad364b8f48571 398.46MB / 3.66GB  328.0s

When you check the sha256 of the layers being pulled again, my first log shows that they are already present. So why are they pulled again? Do I have to passthrough the socket of the host Docker or something? I think docker buildx build ... is run in the bootstrap image, so why does the bootstrap image not use the host's docker cache?

Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.