While trying to deploy docker container we are facing:
FAILED! => {“changed”: false, “msg”: “Error connecting: Invalid response from docker daemon: key "ApiVersion" is missing.”}
Please give some suggestions if any one encounter this kind of issue.
Earlier, I was able to restart and redeploy Docker containers through Ansible without any issues. However, suddenly, we’re encountering an API version issue, and we’re no longer able to start or redeploy containers on the target machines.
This our ansible and python version:
ansible [core 2.11.3]
config file = /etc/ansible/ansible.cfg
configured module search path = [‘/home/user/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.6.8 (default, Nov 15 2024, 08:11:39) [GCC 8.5.0 20210514 (Red Hat 8.5.0-22)]
jinja version = 2.10.1
libyaml = True
Here is an example of the playbook I used to retrieve Docker information from the target machines.
name: Test Ansible-Docker Connection
hosts: all
gather_facts: no
tasks:
name: Get Docker Info
community.docker.docker_host_info:
register: docker_info