Currently container terminal is open with 'sh' running. It would be nice to choose the shell to run in app options - global or per container
@inazar unfortunately not all containers are made equal and not all containers will have the bash/csh/zsh/etc.
There isn't any list of shells available from the settings/container details, and thus it's safe to use 'sh' and allow the user to go into any shell they prefer. (keep in mind most containers never get sshd in unless a custom container image is being made)
I think that, if implemented on a per-container basis, that should be okay. If particular command to execute makes it easier for you to work on your container, you should be able to do so.
Note that this can already be done by running the command yourself: docker exec -it foo/bar bash
@nVitius Have you tried to run the above command of docker exec -it foo/bar bash for a container that does NOT have bash installed? You'll see what I mean.
You can always create a simple .profile entry to start the shell of choice :)
Oh, yeah, I get that; it fails. I just think that, if the user knows that a particular container has a certain shell or other program installed, it should be okay to let them specify it. It could even be something under the "Advanced" tab. Using a .profile is an option too though.
@nVitius Actually this can be done exactly as you mentioned it.
Under the 'General' tab, you can set environment variables. If you want your bash shell to be the default shell for when you 'exec' into the container, then simply add an entry for SHELL with a value of /bin/bash ;)
I was going to whip up some UI for this but just realized @FrenchBen is totally right. Perhaps this just needs a bit of documentation or slap a footnote near the Environment Variables section. Shouldn't need any real substantial code changes since this already works.
Actually this could be included inside Advanced tab. This way the configuration is per container, behind the scenes it will set the SHELL environment variable and you can have a UI piece to configure it instead of having to explain/document.
@fmvilas I'd be curious to hear how you see this working, as the ENV setup is a UI piece that is rather straightforward to configure
You're right but I had to come to this issue to understand that what I needed is to add a new env var. I was suggesting to have a UI piece that sets the right env var with the right value (a list of most commonly used shell binaries and optionally a way to set a custom one). Not sure I'm explaining myself properly :smile:
@fmvilas the issue with that approach is that it may confuse users not familiar with container images and that they don't all carry the shell listed.
aka, as a new user I use an option in the dropdown for bash, I select that and expect bash to work in say alpine:latest
Got it. It's not an easy to solve problem. I see two issues here:
The first one you figure out when the error happens. The second one I think could just be mitigated like this:
[ ] Use custom shell <- A checkbox with label
===== <- a text input here that is enabled when you click on Use custom shell option above
Warning: Make sure this shell is included in your container. <- A label here.
Once you know the first problem you will try to find something in configuration and if you find that piece it will be easier to understand. This could be complemented with an explanation text on the environment variables section, explaining that setting SHELL var will work.
Another option coming to my mind is adding a dropdown to the Exec button with the option: "Use a custom shell" and in the dialog explain the user needs to make sure the "custom shell" exists in the container.
They are not perfect but it could give some clues to the user.
P.S.: Sorry for the long text, hope it can help in some way 馃槉
@fmvilas the checkbox setup seems sound
Couple of points/questions:
custom shell will essentially be an ENV var, correct?SHELL?Either way feel free to open a PR with the needed changes 馃槈
@FrenchBen I'll be happy to submit a PR after we agree on a solution hehe.
The checkbox for your custom shell will essentially be an ENV var, correct?
Yes.
If the above is true, do you now filter the ENV vars displayed in the general section?
I don't understand this question. My point here was just to add an ENV var and of course it will be also visible on the ENV vars section.
How do you deal with images that define an ENV var of SHELL?
That's a good point. I'm not sure if we can have a way to know it beforehand but, if not, we can just add a message as a "warning" label when setting your own shell. As a first iteration is fine and then it might be improved if possible.
Since the ENV tab will show the shell, is there really a need for the checkbox.
Although 'warnings' are all over the place, users will try to set a shell that the container doesn't have, and will open an issue here when the container dies.
I just found this issue, and then noticed under Preferences in Kitematic there is now a App Shell, and you can pick between sh and bash. So this issue may be closable!
As a windows user, i'd like "powershell" in the list please. It would be very handy
when selecting sh or bash in windows, you get the powershell, ... but i have git-bash installed, and want to use it, there is no chance to configure it, please make it configurable ... kind regards
Most helpful comment
@nVitius Actually this can be done exactly as you mentioned it.
Under the 'General' tab, you can set environment variables. If you want your bash shell to be the default shell for when you 'exec' into the container, then simply add an entry for
SHELLwith a value of/bin/bash;)