Open glours opened 2 years ago
cc (me): @dockertopia so I can see this also in my PR queries.
An interesting requirement would be for Ansible.
Currently the community.docker
is widely used Ansible Collection. It currently depends on Compose v1.x because Ansible Modules / Plugins generally depend on Python Libraries / APIs. Since v1.x
is deprecated, and the compose v2 is a standalone Golang plugin, it becomes difficult to implement / update the collection.
There is a possible solution python-on-whales
which is generally just a Wrapper over the Docker CLI, as opposed to docker
pip package which talks directly Docker Engine.
However, based on the discussion for the community.docker future roadmap it is still under consideration by the Maintainer. A possible exposed library / API would be a great help especially the current DevOps / IaaC landscape.
cc @felixfontein (maintainer of Ansible community.docker collection), might have some feedback here for community.docker for docker compose v2 roadmap
Any updates on this subjects ?
Using Docker Compose as a library isn't useful for Ansible since Docker Compose isn't written in Python anymore, but in Go. But having a way to get machine readable output (see also https://github.com/docker/compose/issues/10872) for commands such as docker compose up
, docker compose down
, docker compose pull
, docker compose stop
, etc. would really help a lot. I've been looking at implementing support for Docker Compose v2 in Ansible modules during the last week and it has been a really frustrating experience, I constantly find new ways messages are written to stderr.
At least having a way to enable JSON stream output with some basic structure (that can easily be extended since it's JSON) would be extremely helpful to be able to use Docker Compose by shelling out.
Tell us about your request Provide a stable Golang API for Docker Compose to let developers use Compose inside their own development without doing shell out.
Which service(s) is this request for? Docker Compose
Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard? We have users asking if they can the
cmd
orpkg
packages as a stable reference to embed Compose inside their own development. For now the answer is that we don't guarantee backward compatibility in Compose internals between 2 versions. We may consider to make interfaces present inpkg
directory more stable and support an API usage of those interfaces.Are you currently working around the issue? Not especially but the interfaces of Compose V2 are pretty stable now.
Additional context https://github.com/docker/compose/issues/9602 https://github.com/docker/compose/pull/9579