bashdockervisual-studio-codevscode-devcontainer

How to start a devcontainer in vscode with bash instead of sh?


All my devcontainers start always with sh, I have to manually type /bin/bash every time.

I first tried adding

CMD ["/bin/bash"]

at the end of my Dockerfile, but it still starts with ˋshˋ.

THen I tried doing this on my devcontainer:

{
    "name": "My environment",
    "dockerFile": "Dockerfile",
    "remoteUser": "dev",
    "settings": {
        "terminal.integrated.shell.linux": "/bin/bash"
      },
    "postCreateCommand": "/bin/bash"
}

but it still starts with sh and then keeps running the /bin/bash post create command forever


Solution

  • The settings can be overriden by SHELL variable.

    Try to insert :

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