-
Notifications
You must be signed in to change notification settings - Fork 121
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
Future of community.docker #364
Comments
I'm interested in at least keeping (most of) the Docker "plain" modules / plugins alive, probably by allowing them to work without the Docker SDK for Python. (I still don't use Swarm or Docker Compose, and I'm kind of glad especially about the latter.) This will be a not be something easy, but I think it's worth it - also since it would allow to run the modules / plugins without installing anything. |
Another possibility is not to use (fork & maintain) the sdk but directly use the docker engine api* (what the sdk is also doing imo).
|
@markuman that's what I mean with "work without the Docker SDK for Python" :) |
Directly related to docker/compose#9510 - please comment there, maybe we can get few more months to perform a migration out of docker_compose if we can fix the too restrictive pinning of dependencies. |
If its going to be refactored completely, I have some bugs that I have yet to file on some of the commands where they are doing more than is necessary to complete the requested task based on the module arguments provided and in some cases that leads to failure where it really shouldnt. I have to find my old tickets for the manual process on how to reproduce the issue, but basically one example I think was the docker_image task is unable to remove an image if you have overlayfs corruption issues (despite the docker-cli tools being able to do it perfectly fine) because it would collect info from the overlayfs that it didnt really need before actually using the API call to remove the image. I basically had to create a custom module that did nothing but call the API to remove the image to work around issues like this. For us this corruption usually happens in our in field IOT devices while dowloading images that get interrupted due to bad network connectivity, so the corruption itself is a Docker side issue but the fact that we cant recover using the Ansible modules while we can recover with the docker-cli is a module implementation issue. Food for thought. |
@ju2wheels please file the bugs in new issues. This is not really related to this discussion. |
I think we need to wait and see what the status of the Docker SDK will be. After all, it is maintained by the Docker team. Alternatives are to work directly with Docker API or use other SDK (probably not possible except for current SDK forks). |
That "need to wait"... until forever? ;) I doubt they are going to do anything TBH. Best bet would be to fork old compose and publish that fix under a different package name. After this work to migrate to use of cli for compose can be started. |
I don't think anyone of us is interested in maintaining a fork of either Docker SDK for Python or Docker Compose. |
One thing that could be interesting is vendoring the Docker SDK for Python into the collection, or at least parts of it. (That would also allow us to update it independently, and we could kill (some of) the code that handles different versions of it.) I've looked at how to implement some things yesterday and today, and especialy all the code that handles talking to the daemon (via Unix sockets, IP sockets, TLS, SSH, ...) will be painful to reimplement, while Docker SDK for Python already has pretty mature code for this. I created ansible-community/community-topics#109 to discuss the licensing issues for this. |
What about creating commands by hand and invoking them through Example:
would become something along the lines of |
For docker_compose that's likely what needs to be done, though no idea how easy/hard that is to do, and no idea how check mode can be done this way. For other modules, I would really, really avoid that. |
Turns out the licensing discussion was already resolved ... one year ago. Damn, I completely forgot :) So including Apache 2.0 licensed content is totally fine as long as it is in module_utils (or complete modules), and you avoid importing GPL licensed code in it. Simply vendoring the Docker SDK for Python won't work well since it is Python 3.6+ by now, while this collection stlil supports Python down to 2.6. (Even though you'll have to use a very old Docker SDK for Python for 2.6 support...) But we can extract the basic connection handling and util code from Docker SDK for Python and do not have to reimplement that. (And we can mix code from several versions of it, to get something that supports 2.6+.) I'll probably look into that soon... |
@felixfontein Thanks for helping with this, especially as every day passing is hurting molecule-docker users. IMHO, i would just drop support for old python and make a new release with vendored version as soon as possible. If anyone wants to fix problems related to py2, they are welcome to spend some time doing so. Based on what I seen so far, there are not many around willing to help. I will be quite happy to bring back the plugin to the list of supported plugins. Replacing the docker_compose module with command line calls can come later, when the pressure is smaller. |
I got bit really nastily by adopting this without knowing better, while still learning the Docker ecosystem. Would be great to put up big disclaimers about these being outdated/unmaintained (for now) in the documentation. |
I finished a PR that vendors some code from Docker SDK for Python (adjusted to work with Python 2.7 and 3.5 as well), and adjusted all plain docker modules (except docker_container and docker_plugin) to use that code instead of relying on the Docker SDK for Python: #387 Reviews/testing/feedback are welcome. I'm also planning to adjust docker_container, but that is going to be more complex. I'll also work on the docker_api connection and the docker_containers inventory plugin. If someone else wants to work on docker_plugin or (some of) the Docker Swarm modules and inventory plugin, feel free to create follow-up PRs. My general idea would be:
Any opinions / comments / feedback? |
+1 to deprecate Python 2.6 support. |
|
CC @Ajpantuso @dariko @DBendit @hannseman @imjoseangel @jgoldschrafe @jwitko @morph027 @porshkevich @ushuz @WojciechowskiPiotr @ximon18 as you have contributed new modules/plugins or stepped up as maintainers in the past, and might have so far missed this discussion. (If you're no longer interested in this collection, sorry for bothering you, simply ignore this discussion / unsubscribe from it :) ) |
Thanks for sharing @felixfontein! Didn't know about this move. I understand from the #387 that we have moved to our own API client and daemon maintenance and we are changing all the modules to work with these. To avoid overlapping on changes, where do you need help? |
@imjoseangel thanks for your message! What would be helpful:
Fortunately all the other modules and plugins (especially the Docker Stack modules, that you @imjoseangel worked on so far) don't need any work, since they "only" work with the Docker CLI tool (or other CLI tools) that aren't affected by any of this. |
A 3.0.0-a1 prerelease has been released with the current state of the |
I think my rewrite of docker_container is ready (#422 for anyone who is interested). Is anyone interested in rewriting docker_plugin, or any of the Swarm modules? Or wants to work on docker_compose? |
@felixfontein How am I supposed to install the pre-release of the collection, the command I was assuming to be working was |
I found it, I need to add That prevents me from using a pre-release inside molecule-docker... |
I've created another WIP PR #429 to adjust docker_plugin. Then all non-Swarm plugins and modules (that use the Docker SDK for Python) have been converted. |
docker_container and docker_plugin have been converted, and docker_container has a few new features that weren't possible with Docker SDK for Python. I've created a new prerelease 3.0.0-a2 with all latest changes. Please test it thoroughly so we can weed out as many potential bugs before the 3.0.0 release as possible :) |
I plan to fix molecule-docker plugin over this weekend, so that should give a good testing ground for the new version. |
I've ceated a 3.0.0-rc1 release with one bugfix (the only bug reported so far). If there are no reports in, say, ~two weeks, I'll create the final 3.0.0 release. |
Looks like Docker SDK for Python is back to being actively maintained, judging from the list of commits to |
I created #435 to keep track of changes to Docker SDK for Python that might need to be cherry-picked to our vendored code. |
I created a 3.0.0-rc2 release chandidate including the changes from Docker SDK for Python. If there are no further bug reports, 3.0.0 will be released in 1-2 weeks. |
https://github.com/gabrieldemarmiesse/python-on-whales (python-on-whales on PyPI) provides a Python interface to compose v2 (the `docker compose` cli plugin), amongst other things. This is a community project, but it was featured on the Docker blog last year https://www.docker.com/blog/guest-post-calling-the-docker-cli-from-python-with-python-on-whales/. It shells out to the docker binary, but that's really the only option with the current `docker compose` interface.
|
I've seen that library before. There are two problems with it:
So if the docker_compose module would start using it to talk to docker-compose 2.0+, it would still need to be able to support docker-compose < 2.0.0 without this library installed, and on Python 2.7, 3.5, and 3.6. Alternatively, maybe it might be interesting to create a new module On the other hand, I'm not sure how useful the python-on-whales library actually is for this task, since composing a command line and calling an external CLI program isn't something that hard to do manually / with |
Give what happened during the last years, I would say that probably the best bet is to just call "docker compose" cli. I am not concerned so much about backwards compatibility because that would be insanely hard to achieve and maintain, likely impossible in some cases too. If anyone need to use old dockers, they should stick with old libraries/modules/collections. Extra libraries in-between would only add another thing to maintain. Usually I am in favour of using APIs, but when it comes to docker, it seems that only stable api is "cli". I find it funny that it took docker team years to put some fixed to old docker python library, and that happens only after we decided to go this way. |
It seens like the last days had a lot of news, first we have the python-on-whales project that uses the CLI tool under the hood. |
I'm currently planning to do the 3.0.0 release this weekend, assuming nobody wants to veto that :) |
I've just released 3.0.0 🎉 I'm closing this issue for now. If someone wants to discuss some aspects we haven't discussed / completed yet, please create a new issue for this. Thanks everyone! |
community.docker has been using the Docker SDK for Python ("docker-py") for almost everything (directly for most content, and indirectly for the docker_compose module; only the docker connection plugin and the docker_stack modules use the CLI tool).
Unfortunately, it looks like he Docker SDK for Python is pretty much dead (PR for adding unmaintained notice, activity since October 2021). Maybe a fork will come up, maybe they'll allow some community folks to take the project over under its current repository and PyPi package name, and maybe it will just die (as the Python docker-compose did).
Anyway, this is a moment to think about what we could and/or should do. Having a fork or the original project continued would obviously be the best solutions ;-) With a fork we might have to adjust the import statements (resp. allow to import both original docker-py and the fork), but (if they don't do something drastic) most things can just stay as they are. In case the project is dead and noone wants to maintain a fork, we do have a problem.
We have four different groups of contents:
Content that uses the Docker CLI program, or something else:
docker
connection pluginnsenter
connection plugin (uses thensenter
CLI tool)docker_machine
inventory plugin (uses thedocker-machine
CLI tool)current_container_facts
module (inspects files)docker_stack*
modulesDocker content that uses the API part of the Docker SDK for Python (i.e. not the high-level functionality)
docker_api
connection plugindocker_containers
inventory plugindocker_swarm
inventory plugindocker_config
moduledocker_container_exec
moduledocker_container_info
moduledocker_container
moduledocker_host_info
moduledocker_image_info
moduledocker_image_load
moduledocker_image
moduledocker_login
moduledocker_network_info
moduledocker_network
moduledocker_node_info
moduledocker_node
moduledocker_prune
moduledocker_secret
moduledocker_swarm_info
moduledocker_swarm
moduledocker_swarm_service_info
moduledocker_swarm_service
moduledocker_volume_info
moduledocker_volume
moduleDocker content that uses the high-level functionality of the Docker SDK for Python
docker_plugin
moduleDocker content that uses the Python version of docker-compose
docker_compose
moduleThe text was updated successfully, but these errors were encountered: