我试着运行devcontainer。设置文件:
devcontainer.json
{
"name": "C++",
"build": {
"dockerfile": "Dockerfile"
},
"features": {
"ghcr.io/devcontainers/features/git:1": {}
}
}
停靠文件
FROM mcr.microsoft.com/devcontainers/cpp:0-debian-11
ARG REINSTALL_CMAKE_VERSION_FROM_SOURCE="3.22.2"
# Optionally install the cmake for vcpkg
COPY ./reinstall-cmake.sh /tmp/
RUN if [ "${REINSTALL_CMAKE_VERSION_FROM_SOURCE}" != "none" ]; then \
chmod +x /tmp/reinstall-cmake.sh && /tmp/reinstall-cmake.sh ${REINSTALL_CMAKE_VERSION_FROM_SOURCE}; \
fi \
&& rm -f /tmp/reinstall-cmake.sh
但是当我尝试运行devcontainer时,我得到错误:
[2022-12-23T18:57:44.771Z] ERROR: invalid character '\x00' looking for beginning of value
[2022-12-23T18:57:44.863Z] Stop (969 ms): Run: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f C:\Users\BOGUS_~1.NEW\AppData\Local\Temp\devcontainercli\container-features\0.25.2-1671821861765\Dockerfile-with-features -t vsc-test-9da7bcb89243449acfae569e26bf0e4b --target dev_containers_target_stage --build-context dev_containers_feature_content_source=C:\Users\BOGUS_~1.NEW\AppData\Local\Temp\devcontainercli\container-features\0.25.2-1671821861765 --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp c:\Projects\docker_projects\Cpp\test\.devcontainer
[2022-12-23T18:57:44.865Z] Error: Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f C:\Users\BOGUS_~1.NEW\AppData\Local\Temp\devcontainercli\container-features\0.25.2-1671821861765\Dockerfile-with-features -t vsc-test-9da7bcb89243449acfae569e26bf0e4b --target dev_containers_target_stage --build-context dev_containers_feature_content_source=C:\Users\BOGUS_~1.NEW\AppData\Local\Temp\devcontainercli\container-features\0.25.2-1671821861765 --build-arg _DEV_CONTAINERS_BASE_IMAGE=dev_container_auto_added_stage_label --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp c:\Projects\docker_projects\Cpp\test\.devcontainer
[2022-12-23T18:57:44.866Z] at Doe (c:\Users\Bogus_Kladik.NEW-PC\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1894:1669)
[2022-12-23T18:57:44.866Z] at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
[2022-12-23T18:57:44.866Z] at async EF (c:\Users\Bogus_Kladik.NEW-PC\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1893:1978)
[2022-12-23T18:57:44.866Z] at async uT (c:\Users\Bogus_Kladik.NEW-PC\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1893:901)
[2022-12-23T18:57:44.866Z] at async Poe (c:\Users\Bogus_Kladik.NEW-PC\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1899:2128)
[2022-12-23T18:57:44.867Z] at async Zf (c:\Users\Bogus_Kladik.NEW-PC\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:1899:3278)
[2022-12-23T18:57:44.867Z] at async aue (c:\Users\Bogus_Kladik.NEW-PC\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:2020:15276)
[2022-12-23T18:57:44.867Z] at async oue (c:\Users\Bogus_Kladik.NEW-PC\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js:2020:15030)
[2022-12-23T18:57:44.882Z] Stop (5862 ms): Run: C:\Users\Bogus_Kladik.NEW-PC\AppData\Local\Programs\Microsoft VS Code\Code.exe --ms-enable-electron-run-as-node c:\Users\Bogus_Kladik.NEW-PC\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\Bogus_Kladik.NEW-PC\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data --workspace-folder c:\Projects\docker_projects\Cpp\test --workspace-mount-consistency cached --id-label devcontainer.local_folder=c:\Projects\docker_projects\Cpp\test --log-level debug --log-format json --config c:\Projects\docker_projects\Cpp\test\.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-12-23T18:57:44.882Z] Exit code 1
[2022-12-23T18:57:44.889Z] Command failed: C:\Users\Bogus_Kladik.NEW-PC\AppData\Local\Programs\Microsoft VS Code\Code.exe --ms-enable-electron-run-as-node c:\Users\Bogus_Kladik.NEW-PC\.vscode\extensions\ms-vscode-remote.remote-containers-0.266.1\dist\spec-node\devContainersSpecCLI.js up --user-data-folder c:\Users\Bogus_Kladik.NEW-PC\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\data --workspace-folder c:\Projects\docker_projects\Cpp\test --workspace-mount-consistency cached --id-label devcontainer.local_folder=c:\Projects\docker_projects\Cpp\test --log-level debug --log-format json --config c:\Projects\docker_projects\Cpp\test\.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-12-23T18:57:44.889Z] Exit code 1
如何解决此问题?
在这些尝试中,我可以注意到Docker桌面的更新,wsl的更新
1条答案
按热度按时间piah890a1#
问题似乎与Docker中BuildKit和内联缓存的使用有关。
建议的解决方法here为:
转到设置〉Docker引擎并将'buildkit'设置为'false':