While browsing through the code and documentation I have found that client library currently doesn't support features like stack deploy, stack rm etc. This is something which is required to deploy a DAB generated by compose and would be required if we want to utilize the docker swarm mode.
Can you please advice what is plan around these newly added features is docker v1.12?
There are various patches already merged for this I believe, see for example #1127 and #1147.
Hi @ashishjain14 , the commands you are referring to (docker stack ...) are actually handled by the docker CLI, meaning they are a client-side feature. Those commands then perform remote operations like creating services and managing tasks, which are implemented in the PRs @kleptog references.
Re-implementing those features in python might or might not be outside of the scope of docker-py. As of now, it is not on the immediate roadmap.
Any plans for release date docker-py with Docker Swarm mode support from 1.12?
I'm not ready to commit to a date yet, but it should happen soon. In the meantime, the master branch is fairly solid so feel free to play around with it until then.
Thanks @shin- will try the master branch and get back.
1.10.1 is on pypi now!
Oops, see this also includes stack commands. Re-opening and renaming.
Based on the comment about stacks being implemented on the cli side. Will this issue then ever get resolved? Or is subprocess.run() the best way to do this for now?
Any update about this feature ?
Any news regarding this issue?
Any plans regarding stack commands?
It's not very confidence inspiring for the future of Swarm if this does not get added..
I just built a whole flow using the docker-py SDK, and I was expecting to implement stack deploy and was shocked when I found the support wasn't there.
It sounds like all the underlying actions docker stack ... commands perform are supported by docker-py (service creation and managing tasks). Maybe all we'd need to do is implement whatever logic is in the docker-cli and do yaml parsing here too? (can anyone point me to where that is located?)
(or uh, maybe we could just call subprocess internally :sweat_smile:)
@ferm10n any luck with that approach?
docker-py project mission is to offer "A Python library for the Docker Engine API", not to re-implement the docker CLI in python.
@ndeloof so just close the issue :roll_eyes:
If you want some software that wraps the CLI for you in a pretty way, you can try https://github.com/gabrieldemarmiesse/python-on-whales . You'd use docker-py if you need to do low level things and you can use python-on-whales for high-level things (like stacks).
It all depends on your use case.
The docs for docker.stack.deploy(...): https://gabrieldemarmiesse.github.io/python-on-whales/sub-commands/stack/
Most helpful comment
I just built a whole flow using the docker-py SDK, and I was expecting to implement stack deploy and was shocked when I found the support wasn't there.