Exec shell: autodetect container shell

Some containers may have bash installed but some have only basic sh (Ash/Dash).
There is other shells too: ZSh, tsh etc.

We can automatically detect what shell is configured.
See explanation how it works https://github.com/moby/moby/issues/41702
This commit is contained in:
Sergey Ponomarev 2020-12-12 18:40:31 +02:00
parent 415b14fb10
commit 430600063c
2 changed files with 2 additions and 2 deletions

View file

@ -47,7 +47,7 @@ customCommands:
containers:
- name: bash
attach: true
command: docker exec -it {{ .Container.ID }} /bin/sh
command: "docker exec -it {{ .Container.ID }} /bin/sh -c 'eval $(grep ^$(id -un): /etc/passwd | cut -d : -f 7-)'"
serviceNames: []
oS:
openCommand: open {{filename}}

View file

@ -344,7 +344,7 @@ func GetDefaultConfig() UserConfig {
Containers: []CustomCommand{
{
Name: "bash",
Command: "docker exec -it {{ .Container.ID }} /bin/sh",
Command: "docker exec -it {{ .Container.ID }} /bin/sh -c 'eval $(grep ^$(id -un): /etc/passwd | cut -d : -f 7-)'",
Attach: true,
},
},