Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devcontainers should not set SHELL in the environment #1205

Open
bk2204 opened this issue Sep 30, 2024 · 1 comment
Open

Devcontainers should not set SHELL in the environment #1205

bk2204 opened this issue Sep 30, 2024 · 1 comment
Assignees

Comments

@bk2204
Copy link

bk2204 commented Sep 30, 2024

At work, we're using a devcontainer built from mcr.microsoft.com/vscode/devcontainers/universal:2-focal in GitHub Codespaces. Unfortunately, this image sets the SHELL environment variable to /bin/bash, which is not correct.

As an example of the problems this causes, I use zsh and have it set as the default login shell in my codespace. However, since SHELL is set to /bin/bash, when I open tmux, it spawns bash, not zsh.

POSIX states about this environment variable that “[t]his variable shall represent a pathname of the user's preferred command language interpreter.” Since the devcontainer cannot know what the user's preferred command language interpreter is, this should not be set at all. bash may be a reasonable default as a login shell if one is not otherwise specified (and that's the default in Debian and Ubuntu anyway), but that should be able to be done without setting SHELL.

Normally, I would send a patch to fix this, but you have a CLA, and I don't sign CLAs. So I'm filing this issue so it can be appropriately fixed.

@sireeshajonnalagadda
Copy link

Hi @bk2204,
yes, you are right!
Using the shell environment variable in a Dockerfile leads to default shell /bin/bash.

I understand your concern!
But, for universal image there is a special attention as they handle this image codespace creation differently.
So, changes in the image might behave differently.

Instead you can use containerEnv to use zsh as your preferred shell inside the container.

"containerEnv": {
"SHELL":"/bin/zsh"
}

I hope this info works for you!

Thanks,
Sireesha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants