Skip to content

If "docker compose images" logs to stderr, task execution fails #1216

@niels-hb

Description

@niels-hb
SUMMARY
ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.docker.docker_compose_v2

ANSIBLE VERSION
ansible [core 2.19.4]
  config file = ./ansible/ansible.cfg
  configured module search path = ['~/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /nix/store/90jiynl0ah5z92p41xg4n2vbkdqayfci-python3.13-ansible-core-2.19.4/lib/python3.13/site-packages/ansible
  ansible collection location = ~/.ansible/collections:/usr/share/ansible/collections
  executable location = /nix/store/90jiynl0ah5z92p41xg4n2vbkdqayfci-python3.13-ansible-core-2.19.4/bin/ansible
  python version = 3.13.9 (main, Oct 14 2025, 13:52:31) [Clang 21.1.2 ] (/nix/store/hv7qldswrqvg1sjys1lmgjg875hkffng-python3-3.13.9/bin/python3.13)
  jinja version = 3.1.6
  pyyaml version = 6.0.3 (with libyaml v0.2.5)
COLLECTION VERSION
Collection       Version
---------------- -------
community.docker 5.0.3
CONFIGURATION
CONFIG_FILE() = ./ansible/ansible.cfg
DEFAULT_HOST_LIST(./ansible/ansible.cfg) = ['./ansible/inventory.yaml']
DEFAULT_ROLES_PATH(./ansible/ansible.cfg) = ['./ansible/roles']
EDITOR(env: EDITOR) = nvim

GALAXY_SERVERS:
OS / ENVIRONMENT

Remote host: Rocky Linux 10.0 (Red Quartz) - x86_64
Ansible host: macOS 26.1 - Apple M3

STEPS TO REPRODUCE
- name: Run docker-compose.yaml
  community.docker.docker_compose_v2:
    project_src: /opt/vault_agent
    state: "present"
services:
  vault-agent:
    image: hashicorp/vault:1.21
    restart: always
EXPECTED RESULTS

call_cli_json should not fail if stdout doesn't contain data.

ACTUAL RESULTS
TASK [vault_agent : Run docker-compose.yaml] ***********************************
[ERROR]: Task failed: Module failed: Error while parsing JSON output of /usr/bin/docker --host unix:///var/run/docker.sock compose --ansi never --progress json --project-directory /opt/vault_agent images --format json: Expecting value: line 1 column 1 (char 0)

fatal: [1.2.3.4]: FAILED! => {"changed": false, "msg": "Error while parsing JSON output of /usr/bin/docker --host unix:///var/run/docker.sock compose --ansi never --progress json --project-directory /opt/vault_agent images --format json: Expecting value: line 1 column 1 (char 0)\nJSON output: "}

Command used to debug behavior:

/usr/bin/docker --host unix:///var/run/docker.sock compose --ansi never --progress json --project-directory /opt/vault_agent images --format json > /tmp/stdout 2> /tmp/stderr

/tmp/stdout (empty file):

/tmp/stderr:

{"error":true,"message":"Error response from daemon: image with reference hashicorp/vault:1.21 was found but does not provide the specified platform (linux/amd64)"}

Possibly relevant code:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions