vscode-remote-release
vscode-remote-release copied to clipboard
Container that builds with docker fails to build with "Rebuild and Reopen in Container"
- VSCode Version: 1.69.2
- Local OS Version: Kubuntu 22.04
- Remote OS Version: Ubuntu 22.04
- Remote Extension/Connection Type: Containers
- Logs:
...
[2022-08-02T21:26:51.162Z]
#0 55.85 Get:154 http://archive.ubuntu.com/ubuntu jammy/main amd64 python3-lib2to3 all 3.10.4-0ubuntu1 [76.2 kB]
#0 56.00 Get:155 http://archive.ubuntu.com/ubuntu jammy/main amd64 python3-distutils all 3.10.4-0ubuntu1 [138 kB]
#0 56.30 Get:156 http://archive.ubuntu.com/ubuntu jammy/main amd64 python3-dev amd64 3.10.4-0ubuntu2 [26.0 kB]
#0 56.31 Get:157 http://archive.ubuntu.com/ubuntu jammy/main amd64 python3-setuptools all 59.6.0-1.2 [339 kB]
#0 57.03 Get:158 http://archive.ubuntu.com/ubuntu jammy/universe amd64 python3-wheel all 0.37.1-2 [31.9 kB]
#0 57.05 Get:159 http://archive.ubuntu.com/ubuntu jammy/universe amd64 python3-pip all 22.0.2+dfsg-1 [1306 kB]
#0 59.60 Fetched 154 MB in 59s (2619 kB/s)
#0 59.60 E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev_5.15.0-41.44_amd64.deb 404 Not Found [IP: 185.125.190.39 80]
#0 59.60 E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
------
[2022-08-02T21:26:51.162Z] error: failed to solve: executor failed running [/bin/sh -c apt-get install --yes clang-format curl g++ git libudev-dev python3-pip]: exit code: 100
[2022-08-02T21:26:51.166Z] Stop (59745 ms): Run: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /home/mason/Projects/bow-tracking/.devcontainer/dockerfile -t vsc-bow-tracking-c22f41ad0c8f1766bbbc9f43847bc559 /home/mason/Projects/bow-tracking/.devcontainer
[2022-08-02T21:26:51.166Z] Error: Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /home/mason/Projects/bow-tracking/.devcontainer/dockerfile -t vsc-bow-tracking-c22f41ad0c8f1766bbbc9f43847bc559 /home/mason/Projects/bow-tracking/.devcontainer
[2022-08-02T21:26:51.166Z] at GR (/home/mason/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:240:1436)
[2022-08-02T21:26:51.167Z] at processTicksAndRejections (node:internal/process/task_queues:96:5)
[2022-08-02T21:26:51.167Z] at async Hu (/home/mason/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:239:2796)
[2022-08-02T21:26:51.167Z] at async tb (/home/mason/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:239:1779)
[2022-08-02T21:26:51.167Z] at async QR (/home/mason/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:245:2006)
[2022-08-02T21:26:51.167Z] at async cb (/home/mason/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:245:3110)
[2022-08-02T21:26:51.167Z] at async i_ (/home/mason/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:245:13194)
[2022-08-02T21:26:51.167Z] at async n_ (/home/mason/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js:245:12950)
[2022-08-02T21:26:51.172Z] Stop (59914 ms): Run: /usr/share/code/code /home/mason/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /home/mason/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /home/mason/Projects/bow-tracking --workspace-mount-consistency cached --id-label devcontainer.local_folder=/home/mason/Projects/bow-tracking --log-level debug --log-format json --config /home/mason/Projects/bow-tracking/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2022-08-02T21:26:51.173Z] Exit code 1
[2022-08-02T21:26:51.175Z] Command failed: /usr/share/code/code /home/mason/.vscode/extensions/ms-vscode-remote.remote-containers-0.241.3/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /home/mason/.config/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /home/mason/Projects/bow-tracking --workspace-mount-consistency cached --id-label devcontainer.local_folder=/home/mason/Projects/bow-tracking --log-level debug --log-format json --config /home/mason/Projects/bow-tracking/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2022-08-02T21:26:51.176Z] Exit code 1
Steps to Reproduce:
Place the following two files in a project's .devcontainer directory and run "Rebuild and Reopen in Container".
// .devcontainer/devcontainer.json
{
"build: { "dockerfile": "dockerfile" }
}
# devcontainer/dockerfile
FROM ubuntu:jammy
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONDONTWRITEBYTECODE=1
RUN apt-get update
RUN apt-get install --yes \
clang-format \
curl \
g++ \
git \
libudev-dev \
python3-pip
The image builds just fine running docker build .devcontainer/.
Does this issue occur when you try this locally?: N/A Does this issue occur when you try this locally and all extensions are disabled?: N/A
After some experimentation, it looks like calling docker image rm on the cached ubuntu:jammy image and rebuilding is a workaround. No idea why it works though.
Could this be a difference between docker build and docker buildx build? There is a "Without Cache" variation of the command that might have helped: "Rebuild Without Cache and Reopen in Container".
If you only add a package to the last RUN apt-get install, the previous RUN apt-get update will be used from Docker's layer cache and might come with outdated package information. You can fix it by changing the Dockerfile to run these two commands in a single RUN, that ensures the package information is updated: RUN apt-get update && apt-get install [...].