community.docker icon indicating copy to clipboard operation
community.docker copied to clipboard

[Docs] Perform docker compose pull without running images

Open lonix1 opened this issue 2 years ago • 3 comments

SUMMARY

For community.docker.docker_compose.

This issue was for running equivalent of $ docker compose pull - pulling images referenced in docker-compose.yml, without running them.

That issue was closed, and it appears that functionality was added.

But there are no docs for that behaviour.

Please advise the syntax, and update the docs for that module?

ISSUE TYPE
  • Documentation Report
COMPONENT NAME

community.docker.docker_compose

ANSIBLE VERSION
core 2.14.6

lonix1 avatar Jun 13 '23 13:06 lonix1

Thing you should note here is that community.docker.docker_compose is meant for Docker Compose v1 (which is written in python) and will be deprecated by Docker ending this month. The Issue you mention doesn't seem have any contributions made actually. It was just closed and the issue was moved.

The Docker Compose v2 has some drawbacks since it is completely re-written in Golang which breaks the community.docker.docker_compose module.

There is currently a draft PR https://github.com/ansible-collections/community.docker/pull/586 which will wrap around the Docker Compose v2 (essentially docker compose as opposed to docker-compose which is v1).

The better solution is to use ansible.builtin.command which will do the docker compose pull command for you at the moment.

shantanoo-desai avatar Jun 13 '23 14:06 shantanoo-desai

@shantanoo-desai Thanks I didn't realise it was still wrapping docker-compose rather than docker compose.

Yes I'm using the shell to do it manually, but wanted to do it more robustly with an ansible module.

lonix1 avatar Jun 13 '23 23:06 lonix1

This can now be done with the docker_compose_v2_pull module. (That one also uses the docker compose CLI.)

felixfontein avatar Jan 27 '24 12:01 felixfontein

The community.docker.docker_compose module has been removed from today's 4.0.0 release. If you are still using it, please upgrade to community.docker.docker_compose_v2, which no longer uses the End of Life versions Docker Compose 1.x.y, but Docker's Compose plugin (version 2.x.y range).

As mentioned above, this is possible with the Compose v2 modules.

felixfontein avatar Oct 20 '24 09:10 felixfontein