[GH-ISSUE #75] [Feature] Add support to attach to running container terminal #7003

Open
opened 2026-04-27 20:01:01 -05:00 by GiteaMirror · 30 comments
Owner

Originally created by @patcfly on GitHub (Sep 12, 2024).
Original GitHub issue: https://github.com/moghtech/komodo/issues/75

I would like to be able to attach to a running container's terminal in the Komodo web ui.

Originally created by @patcfly on GitHub (Sep 12, 2024). Original GitHub issue: https://github.com/moghtech/komodo/issues/75 I would like to be able to attach to a running container's terminal in the Komodo web ui.
GiteaMirror added the enhancement label 2026-04-27 20:01:01 -05:00
Author
Owner

@mbecker20 commented on GitHub (Sep 13, 2024):

I'm not entirely sure how to accomplish this task.

I do have some idea to kind of fake it, achieving something close to an attach using a terminal client interface, and sending every line user executes atomically to docker exec.

I think this docker exec feature is much simpler, and should be able to do everything needed. But it's not docker attach and won't be just like docker attach over ssh. Mainly, the responses won't be stream back, but rather will resolve fully and send back whole response at once. The different wouldn't be noticeable for short running tasks but for anything long running, would give no feedback.

Let me know if this docker exec feature would be useful to you, as a precursor to potential full docker attach with streaming responses

<!-- gh-comment-id:2350105471 --> @mbecker20 commented on GitHub (Sep 13, 2024): I'm not entirely sure how to accomplish this task. I do have some idea to kind of fake it, achieving something close to an attach using a terminal client interface, and sending every line user executes atomically to `docker exec`. I think this docker exec feature is much simpler, and should be able to do everything needed. But it's not docker attach and won't be just like docker attach over ssh. Mainly, the responses won't be stream back, but rather will resolve fully and send back whole response at once. The different wouldn't be noticeable for short running tasks but for anything long running, would give no feedback. Let me know if this docker exec feature would be useful to you, as a precursor to potential full docker attach with streaming responses
Author
Owner

@phillibl commented on GitHub (Oct 25, 2024):

I think having a button in komodo that runs something like 'docker exec -it mycontainer sh' for whatever the container is would be hugely beneficial.

It's easy enough to run over ssh but having the feature in the komodo web ui would be great

<!-- gh-comment-id:2438777617 --> @phillibl commented on GitHub (Oct 25, 2024): I think having a button in komodo that runs something like 'docker exec -it mycontainer sh' for whatever the container is would be hugely beneficial. It's easy enough to run over ssh but having the feature in the komodo web ui would be great
Author
Owner

@markhaines commented on GitHub (Nov 25, 2024):

Would also love to see this. Dockge offers this ability; you can connect directly to the container's shell in the UI and it lets you switch from bash to sh if bash isn't supported. It's super useful and one of the main things missing for me that stops me migrating from dockge solution.

<!-- gh-comment-id:2498118740 --> @markhaines commented on GitHub (Nov 25, 2024): Would also love to see this. Dockge offers this ability; you can connect directly to the container's shell in the UI and it lets you switch from bash to sh if bash isn't supported. It's super useful and one of the main things missing for me that stops me migrating from dockge solution.
Author
Owner

@alphaleonis commented on GitHub (Jan 1, 2025):

Same thing here. It is a really useful feature, so would love to see this implemented. Since for example dockge and portainer have this feature, it should be possible to get some ideas on how one could go about implementing it from there perhaps?

<!-- gh-comment-id:2567111063 --> @alphaleonis commented on GitHub (Jan 1, 2025): Same thing here. It is a really useful feature, so would love to see this implemented. Since for example dockge and portainer have this feature, it should be possible to get some ideas on how one could go about implementing it from there perhaps?
Author
Owner

@ar3thien commented on GitHub (Jan 7, 2025):

+1

<!-- gh-comment-id:2575462047 --> @ar3thien commented on GitHub (Jan 7, 2025): +1
Author
Owner

@SinisterSpatula commented on GitHub (Jan 21, 2025):

+1

<!-- gh-comment-id:2603395027 --> @SinisterSpatula commented on GitHub (Jan 21, 2025): +1
Author
Owner

@henrysaantos commented on GitHub (Jan 30, 2025):

+1

<!-- gh-comment-id:2625121891 --> @henrysaantos commented on GitHub (Jan 30, 2025): +1
Author
Owner

@asad-ali-bhatti commented on GitHub (Feb 13, 2025):

+1

<!-- gh-comment-id:2656721842 --> @asad-ali-bhatti commented on GitHub (Feb 13, 2025): +1
Author
Owner

@flintstones-fred commented on GitHub (Feb 18, 2025):

+1

<!-- gh-comment-id:2665997950 --> @flintstones-fred commented on GitHub (Feb 18, 2025): +1
Author
Owner

@McGinn commented on GitHub (Feb 18, 2025):

+1

<!-- gh-comment-id:2666022364 --> @McGinn commented on GitHub (Feb 18, 2025): +1
Author
Owner

@kingp0dd commented on GitHub (Feb 18, 2025):

I'm not entirely sure how to accomplish this task.

I do have some idea to kind of fake it, achieving something close to an attach using a terminal client interface, and sending every line user executes atomically to docker exec.

I think this docker exec feature is much simpler, and should be able to do everything needed. But it's not docker attach and won't be just like docker attach over ssh. Mainly, the responses won't be stream back, but rather will resolve fully and send back whole response at once. The different wouldn't be noticeable for short running tasks but for anything long running, would give no feedback.

Let me know if this docker exec feature would be useful to you, as a precursor to potential full docker attach with streaming responses

Docker exec one liners will be useful as i think majority of the use cases is this, for debugging or for executing quick backend commands.

I'm not sure if that's what dockge also does. For portainer, i think it's a full attach?

<!-- gh-comment-id:2667017917 --> @kingp0dd commented on GitHub (Feb 18, 2025): > I'm not entirely sure how to accomplish this task. > > I do have some idea to kind of fake it, achieving something close to an attach using a terminal client interface, and sending every line user executes atomically to `docker exec`. > > I think this docker exec feature is much simpler, and should be able to do everything needed. But it's not docker attach and won't be just like docker attach over ssh. Mainly, the responses won't be stream back, but rather will resolve fully and send back whole response at once. The different wouldn't be noticeable for short running tasks but for anything long running, would give no feedback. > > Let me know if this docker exec feature would be useful to you, as a precursor to potential full docker attach with streaming responses Docker exec one liners will be useful as i think majority of the use cases is this, for debugging or for executing quick backend commands. I'm not sure if that's what dockge also does. For portainer, i think it's a full attach?
Author
Owner

@alphaleonis commented on GitHub (Feb 19, 2025):

I'm no expert in this, but found the following issue on github which at least seems to contain some hints on how to accomplish this? (eg. running an interactive shell in a container using the API)

<!-- gh-comment-id:2667695444 --> @alphaleonis commented on GitHub (Feb 19, 2025): I'm no expert in this, but found the [following issue on github](https://github.com/portainer/portainer/issues/2640) which at least seems to contain some hints on how to accomplish this? (eg. running an interactive shell in a container using the API)
Author
Owner

@stonkage commented on GitHub (Mar 12, 2025):

+1

<!-- gh-comment-id:2719162616 --> @stonkage commented on GitHub (Mar 12, 2025): +1
Author
Owner

@nanosonde commented on GitHub (Mar 16, 2025):

Hi!
Maybe you could use ttyd:
https://github.com/tsl0922/ttyd

See the usage examples in the ttyd wiki.

You could run something like:
ttyd <ttyd_options> docker exec -it container bash
It will then start a new web terminal with this command.

<!-- gh-comment-id:2727234618 --> @nanosonde commented on GitHub (Mar 16, 2025): Hi! Maybe you could use ttyd: https://github.com/tsl0922/ttyd See the usage examples in the ttyd wiki. You could run something like: ttyd <ttyd_options> docker exec -it container bash It will then start a new web terminal with this command.
Author
Owner

@nanosonde commented on GitHub (Mar 16, 2025):

Also found this: https://lib.rs/crates/webterm

Also uses xterm.js, backend written in Rust...

<!-- gh-comment-id:2727240599 --> @nanosonde commented on GitHub (Mar 16, 2025): Also found this: https://lib.rs/crates/webterm Also uses xterm.js, backend written in Rust...
Author
Owner

@nanosonde commented on GitHub (Mar 16, 2025):

Proxmox host and container consoles also use xterm.js:

https://github.com/proxmox/pve-xtermjs

(Rust code)

<!-- gh-comment-id:2727250411 --> @nanosonde commented on GitHub (Mar 16, 2025): Proxmox host and container consoles also use xterm.js: https://github.com/proxmox/pve-xtermjs (Rust code)
Author
Owner

@Skyfay commented on GitHub (Mar 27, 2025):

+1

<!-- gh-comment-id:2759148675 --> @Skyfay commented on GitHub (Mar 27, 2025): +1
Author
Owner

@signo1337 commented on GitHub (Apr 9, 2025):

...just to upvote for this crucial feature: +1

<!-- gh-comment-id:2789937435 --> @signo1337 commented on GitHub (Apr 9, 2025): ...just to upvote for this crucial feature: +1
Author
Owner

@Dinth commented on GitHub (Apr 19, 2025):

+1

<!-- gh-comment-id:2816861002 --> @Dinth commented on GitHub (Apr 19, 2025): +1
Author
Owner

@RedVelocity commented on GitHub (Apr 20, 2025):

Just following up on this topic. Is there a roadmap for the exec feature?

<!-- gh-comment-id:2817030496 --> @RedVelocity commented on GitHub (Apr 20, 2025): Just following up on this topic. Is there a roadmap for the exec feature?
Author
Owner

@Skyfay commented on GitHub (Apr 20, 2025):

Just following up on this topic. Is there a roadmap for the exec feature?

As I see it, the problem is that the developer does not know how to implement this task at the moment.

<!-- gh-comment-id:2817046111 --> @Skyfay commented on GitHub (Apr 20, 2025): > Just following up on this topic. Is there a roadmap for the exec feature? As I see it, the problem is that the developer does not know how to implement this task at the moment.
Author
Owner

@Redwid commented on GitHub (Apr 24, 2025):

+1

<!-- gh-comment-id:2826943604 --> @Redwid commented on GitHub (Apr 24, 2025): +1
Author
Owner

@lnlyssg commented on GitHub (Apr 24, 2025):

Please stop commenting +1 - it clutters up the issue and stops any actual useful discussion from being easily seen. If you just want to upvote this then please add a thumbs-up reaction to the issue instead.

<!-- gh-comment-id:2827031226 --> @lnlyssg commented on GitHub (Apr 24, 2025): Please stop commenting +1 - it clutters up the issue and stops any actual useful discussion from being easily seen. If you just want to upvote this then please add a thumbs-up reaction to the issue instead.
Author
Owner

@lnlyssg commented on GitHub (Apr 26, 2025):

It's coming! https://github.com/moghtech/komodo/pull/446

<!-- gh-comment-id:2831962149 --> @lnlyssg commented on GitHub (Apr 26, 2025): It's coming! https://github.com/moghtech/komodo/pull/446
Author
Owner

@Skyfay commented on GitHub (Apr 26, 2025):

It's coming! #446

This will initially only be the implementation for shell access. Exec still has to be executed manually. But Exec will most certainly be built on top of that.

<!-- gh-comment-id:2831965976 --> @Skyfay commented on GitHub (Apr 26, 2025): > It's coming! [#446](https://github.com/moghtech/komodo/pull/446) This will initially only be the implementation for shell access. Exec still has to be executed manually. But Exec will most certainly be built on top of that.
Author
Owner

@mbecker20 commented on GitHub (Apr 27, 2025):

container exec should be simple on top of the shell access in #446 . I'm going to go ahead and implement it before releasing 1.17.4

<!-- gh-comment-id:2833572611 --> @mbecker20 commented on GitHub (Apr 27, 2025): container exec should be simple on top of the shell access in #446 . I'm going to go ahead and implement it before releasing 1.17.4
Author
Owner

@nic96 commented on GitHub (May 9, 2025):

Wouldn't docker attach be just as simple as docker exec -it now that you have a terminal feature? I tested that it works attaching with the terminal feature e.g docker attach --detach-keys=ctrl-d service-name.

The tty and std_open options need to be in the docker compose service to be able to attach and interact:

services:
  hello_world:
    image: hello-world
    tty: true
    stdin_open: true
<!-- gh-comment-id:2867519187 --> @nic96 commented on GitHub (May 9, 2025): Wouldn't `docker attach` be just as simple as `docker exec -it` now that you have a terminal feature? I tested that it works attaching with the terminal feature e.g `docker attach --detach-keys=ctrl-d service-name`. The tty and std_open options need to be in the docker compose service to be able to attach and interact: ``` services: hello_world: image: hello-world tty: true stdin_open: true ```
Author
Owner

@mbecker20 commented on GitHub (Aug 26, 2025):

@nic96 yes I am aware and attach should be fairly straightforward, leaving this issue open to implement this feature.

<!-- gh-comment-id:3222615458 --> @mbecker20 commented on GitHub (Aug 26, 2025): @nic96 yes I am aware and attach should be fairly straightforward, leaving this issue open to implement this feature.
Author
Owner

@Almie commented on GitHub (Feb 11, 2026):

+1 to also having a docker attach feature, would be greatly beneficial for me.

<!-- gh-comment-id:3887546650 --> @Almie commented on GitHub (Feb 11, 2026): +1 to also having a docker attach feature, would be greatly beneficial for me.
Author
Owner

@mbecker20 commented on GitHub (Feb 12, 2026):

@Almie it is available in the dev releases https://github.com/moghtech/komodo/releases

<!-- gh-comment-id:3888792103 --> @mbecker20 commented on GitHub (Feb 12, 2026): @Almie it is available in the dev releases https://github.com/moghtech/komodo/releases
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/komodo#7003