首页 > 解决方案 > VS Code 开发容器:无法下载 VS Code Server

问题描述

每次我更新 VS Code 时,我的开发容器都会中断Failed to download VS Code Server

[16413 ms] Installing VS Code Server for commit d2e414d9e4239a252d1ab117bd7067f125afd80a
[16413 ms] Start: Run in container: mkdir -p /home/<my_username>/.vscode-server/bin/d2e414d9e4239a252d1ab117bd7067f125afd80a_1602875933619
[16432 ms] 
[16432 ms] 
[16470 ms] Start: Downloading VS Code Server
[16686 ms] Failed to download VS Code Server (https://update.code.visualstudio.com/commit:d2e414d9e4239a252d1ab117bd7067f125afd80a/server-linux-x64/stable): HTTP 403 - Forbidden

我很确定这是因为它没有使用代理。

我的 devcontainer.json 指的是图像,而不是 dockerfile,并且 HTTPS_ 和 HTTP_PROXY 被烘焙。还有同名的小写变量。

我有http.proxyhttps.proxy配置在devcontainer.json.

我在守护进程配置中设置了代理,在我的配置文件中设置了我的 docker 配置。其他网络流量使用代理。

我试过用--proxy-server.

我试过设置/etc/wgetrc。这些都没有骰子。

这在 1.47 左右开始出现。

启动后,此容器使用代理没有问题。我的解决方法是从日志中的失败或通过本地运行获取提交 ID code -v,然后将 shell 附加到正在运行的开发容器并运行此节:

commit=d2e414d9e4239a252d1ab117bd7067f125afd80a   # <= replace this

cd ~/.vscode-server/bin
mkdir ${commit}
curl https://update.code.visualstudio.com/commit:${commit}/server-linux-x64/stable -L --output ${commit}.gz
tar --no-same-owner -xz --strip-components 1 -C ./${commit} -f ./${commit}.gz

说我和我的团队对此感到厌倦是轻描淡写的。真正的解决办法是什么?

标签: visual-studio-code

解决方案


看起来这在 1.55.0 中已修复。

w00t w00t!


推荐阅读