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

docker_compose_v2_pull: Pull never completes on slow connection

Open robinelvin opened this issue 8 months ago • 3 comments

SUMMARY

When performing a pull using community.docker.docker_compose_v2_pull - if the remote connection is slow and the pull takes a long time then often Ansible never completes.

If I Ctrl+C and then run the playbook again after waiting long enough then it completes since the pull has actually completed.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

docker_compose_v2_pull

ANSIBLE VERSION
ansible [core 2.18.4]
  config file = /Volumes/Crucial X8/Projects/Recyclever/RVMInfrastucture/infrastructure/ansible/ansible.cfg
  configured module search path = ['/Users/rob/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Volumes/Crucial X8/Projects/Recyclever/RVMInfrastucture/infrastructure/ansible/.venv/lib/python3.12/site-packages/ansible
  ansible collection location = /Users/rob/.ansible/collections:/usr/share/ansible/collections
  executable location = /Volumes/Crucial X8/Projects/Recyclever/RVMInfrastucture/infrastructure/ansible/.venv/bin/ansible
  python version = 3.12.0 (v3.12.0:0fb18b02c8, Oct  2 2023, 09:45:56) [Clang 13.0.0 (clang-1300.0.29.30)] (/Volumes/Crucial X8/Projects/Recyclever/RVMInfrastucture/infrastructure/ansible/.venv/bin/python3)
  jinja version = 3.1.4
  libyaml = True
COLLECTION VERSION
Collection       Version
---------------- -------
community.docker 4.5.2  
CONFIGURATION
CACHE_PLUGIN(/Volumes/Crucial X8/Projects/Recyclever/RVMInfrastucture/infrastructure/ansible/ansible.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(/Volumes/Crucial X8/Projects/Recyclever/RVMInfrastucture/infrastructure/ansible/ansible.cfg) = facts.json
CONFIG_FILE() = /Volumes/Crucial X8/Projects/Recyclever/RVMInfrastucture/infrastructure/ansible/ansible.cfg

GALAXY_SERVERS:
OS / ENVIRONMENT

Target OS is Ubuntu Core 24 running Docker snap. Control OS is Mac OS.

STEPS TO REPRODUCE

Use a target machine that takes a few minutes to pull an image. In my case the image is ~2Gb which takes about 7 minutes to pull, often stalling but will eventually complete.

Target machine snaps:

Name                  Version        Rev    Tracking       Publisher       Notes
core20                20241206       2496   latest/stable  canonical✓      base
core22                20241119       1722   latest/stable  canonical✓      base
core24                20241217       739    latest/stable  canonical✓      base
docker                27.5.1         3064   latest/stable  canonical✓      -
media-player          0.1            x1     -              -               -
mesa-core20           21.2.6         165    latest/stable  canonical✓      -
mesa-core22           23.2.1         368    latest/stable  canonical✓      -
network-manager       1.46.0-2       931    24/stable      canonical✓      -
pc                    24-0.1         x1     -              -               gadget
pc-kernel             6.8.0-54.56    2247   24/stable      canonical✓      kernel
snapd                 2.67           23545  latest/stable  canonical✓      snapd
ubuntu-frame          99-mir2.13.0   5787   latest/stable  canonical✓      -
ubuntu-frame-vnc      0+git.427c516  167    latest/stable  canonical✓      -
usbutils-snap         014            2      latest/stable  drcoccodrillus  -
wpe-webkit-mir-kiosk  2.38.5         100    latest/stable  glancr          -
    - name: Pull Docker Images
      community.docker.docker_compose_v2_pull:
        services: "my_service"
        project_src: my_project
      become: true
EXPECTED RESULTS

The playbook should complete.

ACTUAL RESULTS

It just hangs at the pull task.


robinelvin avatar Apr 03 '25 08:04 robinelvin

The module simply runs docker compose pull (with some more options), If that command doesn't complete, then Ansible won't complete either. I don't think there's anything we can do about this.

felixfontein avatar Apr 03 '25 19:04 felixfontein

I think the command does complete though. As I said, if I kill the playbook run and then run it again it completes and the pull task shows green to say nothing was changed.

robinelvin avatar Apr 04 '25 07:04 robinelvin

The module exists once the command completes.

The actual pulling is done by the Docker daemon, I guess that the daemon finishes pulling, while Compose does not notice that (for whatever reason). So Compose does not return even though the pulling completed. (Or it completed in the time between you cancelling the run and trying again.)

felixfontein avatar Apr 04 '25 11:04 felixfontein