Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Run command in container #83

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

MichaelMackus
Copy link
Contributor

This adds the "run_exec" and "inspect_exec" API endpoints, as well as the corresponding frontend-UI.

Use case is to run a one-off command in a specific container. For example, for some of our docker-compose projects, we want to re-run "provision" (which is our puppet provisioner) without deleting/restarting the container.

@francescou
Copy link
Owner

Hi @MichaelMackus and thanks for your contribution.
It seems to me that the output of the command is not displayed, right?

@MichaelMackus
Copy link
Contributor Author

@francescou that's correct. I elected to leave off that functionality. Some commands might have a large amount of output, and won't fit into an alert window. Then we'd have to consider creating another Modal dialog to view the contents of the Exec. There's no technical limitations for this, though - the docker inspect API endpoint does have the option(s) to include results. We'd just have to figure out how to fit it into the existing UI - should we automatically open the modal after success (we might even be able to include a link to view the output in the alert success window), or do we want another area in the UI to view the Execs.

@francescou
Copy link
Owner

Hi @MichaelMackus sorry for my late reply.

I see your concern. Actually, things would be even more difficult if we want to provide support for streaming output commands (e.g. top). We would need a terminal (as discussed in #4) to do so.

@MichaelMackus
Copy link
Contributor Author

MichaelMackus commented Jun 5, 2017

@francescou right, that's why I've left off that functionality. This is PR is just to solve the issue of running a one-off background process in the container (i.e. git pull, install some software via package manager, or temporarily suspend/run a service for testing).

Just to be clear, the inspect_exec API endpoint is currently used to just check the status of an executed command.

@francescou
Copy link
Owner

Hello @MichaelMackus, and sorry (again) for my late reply.

I've investigated about how to integrate your work with portainer in order to provide an interactive console.
The frontend should be straightforward to implement but you should modify your code to run /bin/sh and enable tty.

If you're interested we can work on this feature.

@MichaelMackus
Copy link
Contributor Author

Ooo, nice. I will look into portainer as well and let you know what I find.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants