简体   繁体   中英

Perform a docker-compose pull via Ansible

Question

With the Ansible docker_compose module is it possible to perform a docker-compose pull and/or docker-compose build without actually starting the service?


What have I tried?

I've attempted:

    - name: Build & pull services
      become: yes
      docker_compose:
        project_src: "{{ installation_path }}"
        build: yes
        state: present
        stopped: yes

but this seems to start the services as well (even though I have stopped: yes ).


Use case

The actual situation is that starting the services causes ports conflicts with existing processes. So the idea is to:

  • Stop the conflicting processes
  • Start the docker services

The problem is that one of these processes is the one that resolves DNS queries so stopping the processes and starting the docker services leads to an attempt to fetch the docker images from the docker registry, failing with a DNS resolution error.

My idea was to:

  • Pull every necessary image
  • Stop the conflicting processes
  • Start the docker services

根据这个 Github 问题,这是不可能的,并且鉴于docker_* 没有得到积极维护,因此在不久的将来可能会保持不变

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM