From 430600063cea638f91bf7b15830b0e62d7e768ca Mon Sep 17 00:00:00 2001 From: Sergey Ponomarev Date: Sat, 12 Dec 2020 18:40:31 +0200 Subject: [PATCH] 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 --- docs/Config.md | 2 +- pkg/config/app_config.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Config.md b/docs/Config.md index c67562f5..5f35dc72 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -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}} diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go index edf4591b..8c8fa8a9 100644 --- a/pkg/config/app_config.go +++ b/pkg/config/app_config.go @@ -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, }, },