Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow executing docker commands directly #165

Open
mxrlkn opened this issue Aug 31, 2018 · 5 comments
Open

Allow executing docker commands directly #165

mxrlkn opened this issue Aug 31, 2018 · 5 comments

Comments

@mxrlkn
Copy link

mxrlkn commented Aug 31, 2018

I have an existing swarm setup already running traefik. I've run into several issues deploying docker-compose.yml files. It seems exoframe works best with a fresh swarm where exoframe sets up traefik automatically.

What I'd like is a kind of simple mode where I can write a a normal compose file, define swarm specific settings like usual (deploy: labels, etc.), and have, e.q. exoframe swarmdeploy mystack basically do a docker stack deploy -c compose.yml mystack.

What I'm really missing from vanilla swarm is a cli/token setup. I don't want to open up the docker deamon port or deploy via ssh and copy my compose files over.

It's probably out of scope though for this project, and would bypass templates, recipes, traefik auto setup.

Looks like a great project for a new swarm.

@yamalight
Copy link
Contributor

That should be possible with see minor tweaks 🤔
I can give you more details once I'm back from vacation.
Can you please describe your requirements (or use case) a bit more in-depth?

@mxrlkn
Copy link
Author

mxrlkn commented Sep 1, 2018

Use case is just to use exoframe as a "dumb" cli. being able to control docker without having to ssh in or open the docker daemon with tls. With a token system. Mainly for use with ci/cd pipelines.

Now that I think about it, it would probably make sense to just pipe commands straight to the docker cli, that way all of the docker commands would be available via exoframe without any extra custom integration.

So I could do e.q. cat docker-compose.yml | exoframe docker stack deploy -c - mystack.
or exoframe docker stack ls.

Then exoframe would just append everything after exoframe docker to docker {command}, run it, and pipe the output back.

that would of course also give regular exoframe users all the native docker commands that's not implemented in exoframe. :)

@yamalight
Copy link
Contributor

While that does sound like a pretty neat idea (quite like it actually!) - currently it'd require some additional work to implement.
Current version of Exoframe uses docker API and does not rely on (or includes) docker binary at all - so that's one thing to address 🤔
I imagine there's going to be more than one edge case that would result in need for workarounds.

I will rename the ticket to reflect the feature and will try to figure out what's needed to make that work. Thanks for the suggestion!

@yamalight yamalight changed the title docker swarm "simple mode" Allow executing docker commands directly Sep 3, 2018
@yamalight yamalight added this to the 4.0 milestone Sep 3, 2018
@mxrlkn
Copy link
Author

mxrlkn commented Sep 4, 2018

I see the problem now. Exoframe is using dockerode, which doesn't use the docker cli, only the docker API. And it also doesn't support stacks yet, which was my main problem.

The docker cli also needs to run the same version as docker on the host.

So I guess the only way to do this really, is on runtime, check the docker host version via the docker API, curl and install the correct binary from https://download.docker.com/linux/static/stable/x86_64.

then create an endpoint that execs docker {command}.

All of the above could be turned on/off via an environment variable. Maybe with a small caution 😄

It's of course a bit annoying to do it at runtime, but I don't see another way around it.

Is this something you would be open to? I could do a PR for it.

@yamalight
Copy link
Contributor

@marktheis that sounds like a solid approach! would absolutely be open to a PR :)

@yamalight yamalight modified the milestones: 4.0, post-4.0 Jan 24, 2019
@yamalight yamalight removed this from the post-5.1 milestone Sep 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants