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

887 views Asked by At

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

1

There are 1 answers

0
Philippe On BEST ANSWER

The settings can be overriden by SHELL variable.

Try to insert :

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