code-server icon indicating copy to clipboard operation
code-server copied to clipboard

[v2] Use bash by default in the Docker container

Open paolomainardi opened this issue 7 years ago • 10 comments

Description

Terminal does not start with bash shell when opened for the first time.

Screenshot 2019-08-18 at 13 35 52

paolomainardi avatar Aug 18 '19 11:08 paolomainardi

In my experience it just uses your login shell. Could you try chsh -s bash and see if that helps?

deansheather avatar Aug 19 '19 10:08 deansheather

vscode also has a setting to override the default shell used. In our case, it was easier to do something like:

cat << EOF > /home/coder/.config/code-server/User/settings.json
{
    "terminal.integrated.shell.linux": "/bin/bash"
}
EOF

since we also needed to override other settings.

cfi2017 avatar Aug 19 '19 10:08 cfi2017

For anyone wondering, VS Code uses $SHELL by default so this happens when that environment variable isn't set.

code-asher avatar Aug 26 '19 16:08 code-asher

Closing since I don't believe there is anything reasonable we can do here. If $SHELL isn't set sh is the safest fallback.

code-asher avatar Sep 18 '19 15:09 code-asher

Reopening because in the Docker container at least we should be able to set the default shell to bash.

code-asher avatar Sep 18 '19 16:09 code-asher

just slap this in and this will make it the default


ENV SHELL /bin/bash

sr229 avatar Sep 18 '19 17:09 sr229

I was thinking the same thing but then I wondered if we could pull it from the user. Normally I think login sets $SHELL based on /etc/passwd but maybe we can just read it ourselves when $SHELL isn't set. That would have the advantage of working in other situations as well.

code-asher avatar Sep 18 '19 18:09 code-asher

It's Works - saved my time

ishu-harsh avatar Feb 23 '21 08:02 ishu-harsh

Hm, does not work for some strange reason.

`FROM ubuntu:focal

ENV PYTHONUNBUFFERED=1

ENV SHELL /bin/bash

RUN mkdir /data /compute /static /appmedia

RUN apt update && apt install -y build-essential wget

RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh &&
/bin/bash ~/miniconda.sh -b -p /opt/conda &&
rm ~/miniconda.sh &&
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh &&
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc &&
echo "conda activate base" >> ~/.bashrc

WORKDIR /app COPY requirements.txt /app/ RUN conda install --file requirements.txt`

returns:

ERROR: Service 'web' failed to build: The command '/bin/sh -c conda install --file requirements.txt' returned a non-zero code: 127

sorenwacker avatar Apr 18 '21 19:04 sorenwacker

@soerendip I believe 127 means command not found so you probably need to install conda.

code-asher avatar Apr 20 '21 15:04 code-asher