VSCode throws error when setting PATH environment variable in devcontainer.json
我在项目中有以下
当我尝试在容器中打开VSCode时,它崩溃了。 容器成功构建,但是在启动过程中会发出以下日志。 当我删除环境变量配置时,容器将启动并保持正常运行。
根据用于高级容器配置的Visual Studio代码文档,我遵循了在dev容器内配置环境变量的示例。
问题:如何在
devcontainer.json
1 2 3 4 5 6 7 8 9 10 | { "name":"Ubuntu 18.04 & Git", "dockerFile":"Dockerfile", "settings": { "terminal.integrated.shell.linux":"/bin/bash" }, "containerEnv": { "PATH":"${containerEnv:PATH}:/root/.customfolder/bin/" } } |
日志
1 2 3 4 5 6 7 8 9 10 11 12 13 | 6499 ms] Successfully built 096d41dceada [6503 ms] Successfully tagged vsc-asdf-73cee28d5205fdd4a6063fc596248885:latest [6506 ms] Start: Run: git rev-parse --show-toplevel [6533 ms] Start: Starting container [6533 ms] Start: Run: docker run -a STDOUT -a STDERR --mount type=bind,source=/Users/username/git/asdf,target=/workspaces/asdf,consistency=cached --mount source=/Users/username/.aws/credentials,target=/root/.aws/credentials,type=bind -l vsch.quality=stable -l vsch.remote.devPort=0 -l vsch.local.folder=/Users/username/git/asdf -e PATH=${containerEnv:PATH}:/root/.customfolder/bin/ --entrypoint /bin/sh vsc-pulumi-73cee28d5205fdd4a6063fc596248885 -c echo Container started ; while sleep 1; do :; done [6852 ms] /bin/sh: 1: sleep: not found [6852 ms] Container started [6873 ms] Start: Inspecting container [6879 ms] Start: Run in container: uname -m [7031 ms] Start: Run in container: cat /etc/passwd [7035 ms] Shell server terminated (code: 1, signal: null) Error response from daemon: Container 8e0f6eeb22c358b0dfd8f1c1410c10b382ea66aa432e7e400a4564671619046f is not running |
An error occurred setting up the container
环境
- MacOS卡塔利娜
- Docker桌面2.2.0.0
- Microsoft Visual Studio代码1.42.0
- VSCode远程容器扩展0.101.0
您应该可以将属性从
仅
对于其他所有内容,自VS Code以来,
1 2 3 4 5 | "remoteEnv": { "PATH":"${containerEnv:PATH}:/some/other/path", "MY_REMOTE_VARIABLE":"some-other-value-here", "MY_REMOTE_VARIABLE2":"${localEnv:SOME_LOCAL_VAR}" } |