Open jastich opened 1 year ago
Any news on that? I also stumbled across this?
Variables read from a .env file. Added to the local environment variables.
% printenv | grep NODEV NODEVARIANT=20
{ "name": "devcontainer", "build": { "dockerfile": "Dockerfile", "args": { "NODEVARIANT": "${localEnv:NODEVARIANT}" [...] "initializeCommand": "export $(cat .envFile | xargs)"
My Dockerfile:
ARG NODEVARIANT FROM my.docker.repo/my-image-with-node-${NODEVARIANT}:latest
When the container starts it fails because it can't find the image because the build arg is NODEVARIANT is empty.
Error: Command failed: docker inspect --type image my.docker.repo/my-image-with-node-:latest
It would be awesome to use this approach, so that we can have the devcontainer in a more generic approach in one git repo and add it as git submodule in all our projects which may need different node versions respectively a different docker image.
The file with the variables will then be residing in the main git project.
Any news on that?
This is also happening to me with tcsh. The -lic argument to tcsh throws and error since the -l cannot have other arguments. Here is the --help:
tcsh 6.22.03 (Astron) 2020-11-18 (x86_64-unknown-linux) options wide,nls,dl,al,kan,sm,rh,color,filec
-b file batch mode, read and execute commands from `file'
-c command run `command' from next argument
-d load directory stack from `~/.cshdirs'
-Dname[=value] define environment variable `name' to `value' (DomainOS only)
-e exit on any error
-f start faster by ignoring the start-up file
-F use fork() instead of vfork() when spawning (ConvexOS only)
-i interactive, even when input is not from a terminal
-l act as a login shell, **must be the only option specified**
-m load the start-up file, whether or not owned by effective user
-n file no execute mode, just check syntax of the following `file'
-q accept SIGQUIT for running under a debugger
-s read commands from standard input
-t read one line from standard input
-v echo commands after history substitution
-V like -v but including commands read from the start-up file
-x echo commands immediately before execution
-X like -x but including commands read from the start-up file
--help print this message and exit
--version print the version shell variable and exit
Is there a way to override this userEnvProbe shell? I would rather use bash anyway. Our IT forces our default to tcsh.
FYI: I found and tried setting the "envUserProbe" setting to all of the other options and none work. It does not seem to affect anything, since it still uses the loginInteractiveShell, regardless to the "envUserProbe":
"userEnvProbe": "interactiveShell"
[344 ms] userEnvProbe: loginInteractiveShell (default)
[344 ms] userEnvProbe: not found in cache
[344 ms] userEnvProbe shell: /bin/tcsh
[385 ms] Error reading shell environment.
[385 ms] Command failed: /bin/tcsh -lic echo -n <...redacted...>
We craft a
devcontainer.json
which uses external environment variables (e.g.,USER_GID
) to pass as arguments to aDockerfile
. Our organization uses C shell for legacy reasons. The environment variables are not being sourced properly within the devcontainer.json and are being passed as empty strings to Docker. This configuration previously worked for us, but then suddenly stopped working. We are not aware of any upgrades on the remote server that would have caused this issue. We are able to reproduce with versions 1.78.x, 1.79.x, and 1.80.x of VSCode as well.Suspect: The userEnvProbe returns "command failed" after invoking
/bin/csh
. See full log output below.[2023-08-11T21:08:32.818Z] Command failed: /bin/csh -lic echo -n 37e1098e-91ff-4f6a-b3be-978321f72cfd; cat /proc/self/environ; echo -n 37e1098e-91ff-4f6a-b3be-978321f72cfd
Attempted to try the
/bin/csh -lic
command in my own terminal. Found thatcsh
fails if the-l
flag is used in combination with other arguments. Iscsh
supported?Eventually fails with the output of the Dockerfile build:
[2023-08-11T21:08:39.689Z] groupadd: invalid group ID ''
After I installed insiders, I was able to "open in container" on first use. Subsequent attempts to rebuild the container failed.
On SSH remote:
Docker version 19.03.15, build 99e3ed89195c
Steps to Reproduce:
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
Our
devcontainer.json
:Dockerfile:
Shell output in SSH environment (within VSCode terminal):