jesseduffield / lazydocker

The lazier way to manage everything docker
MIT License
37.07k stars 1.19k forks source link

Hotkey for entering a running container's shell #385

Open kbairak opened 2 years ago

kbairak commented 2 years ago

Is your feature request related to a problem? Please describe. It is very useful to enter a running container's shell. A shortcut for this would be appreciated. I don't need this for myself as already have a workaround. I think it would be nice for others.

Describe the solution you'd like A built-in hotkey that, when pressed on a service, enters the containers shell via docker exec.

Describe alternatives you've considered Here is what I have in my config file:

---
customCommands:
  containers:
    - name: shell
      attach: true
      command:
        docker exec -it {{ .Container.ID }} sh -c 'for SH in $(echo bash sh); do if (eval $SH); then exit 0; fi; done || exit 1'
      serviceNames: []

(My bash scripting skills is not something I boast about)

This way, pressing c on a running service gives me the "shell" option I can use to enter a container's shell.

Additional context If this were to be implemented and documented, a note that the service must be configured with stdin_open and tty in order for this to work would be helpful.

mark2185 commented 2 years ago

@kbairak Isn't that behind the E key?

The menu states E exec shell

kbairak commented 2 years ago

I hadn't discovered this before. Still, it only works on the "Standalone Containers" window, not the "Services" window.