Closed D0wn3r closed 3 months ago
Maybe this issue is because of the requests upgrade https://github.com/docker/docker-py/issues/3256
if I force requests
package version 2.31.0, it works
I guess you are using community.docker before 3.10.2. (You only provided the community.general version.) Either upgrade community.docker to the latest version (it fixed this issue yesterday), or stick to requests < 2.32.0
.
Also please consider searching for similar error messages in the repository before creating a new issue the next time. You would have found two closed issues.
I guess you are using community.docker before 3.10.2. (You only provided the community.general version.) Either upgrade community.docker to the latest version (it fixed this issue yesterday), or stick to
requests < 2.32.0
.Also please consider searching for similar error messages in the repository before creating a new issue the next time. You would have found two closed issues.
# <path>/.ansible/collections/ansible_collections
Collection Version
---------------- -------
community.docker 3.10.2
I'm using the latest version
Same here, i just did a completely fresh install and this issue appears.
community.docker
is on the same version: 3.10.2
I did, however, notice that i am using community.docker.docker_compose
, which is deprecated (without deprecation warning on the docs), and i am not getting the same error on community.docker.docker_compose_v2
.
Interestingly this issue is indexed by google, whereas the other two you are referring to are not
I did, however, notice that i am using
community.docker.docker_compose
, which is deprecated (without deprecation warning on the docs),
Apparently the latest Ansible docs weren't rebuilt for the Ansible 9.6.0 release. The docs here: https://docs.ansible.com/ansible/devel/collections/community/docker/docker_compose_module.html#deprecated and here: https://ansible-collections.github.io/community.docker/branch/main/docker_compose_module.html#deprecated show that warning.
and i am not getting the same error on
community.docker.docker_compose_v2
.
Which is not surprising, since that module calls the docker compose
CLI tool. No Python requests or Docker SDK for Python involved.
I guess you are using community.docker before 3.10.2. (You only provided the community.general version.) Either upgrade community.docker to the latest version (it fixed this issue yesterday), or stick to
requests < 2.32.0
. Also please consider searching for similar error messages in the repository before creating a new issue the next time. You would have found two closed issues.# <path>/.ansible/collections/ansible_collections Collection Version ---------------- ------- community.docker 3.10.2
I'm using the latest version
In that case I have no idea what's going wrong in your case, since everything works both fine in CI and on my local machine with the latest requests.
Are you using a special way to talk to the Docker daemon, or are you using the default way (default Unix socket)?
@D0wn3r just to make sure, are you sure that you got the error with docker_host_info on community.docker 3.10.2? Or did you got it with some other modules, for example docker_swarm or dockerswarm*?
@timon-michel-scopevisio also note that docker_compose requires Docker SDK for Python < 7.0.0 (it will crash and burn with 7.0.0), and that will never receive a fix for requests 2.32.x. If you want to stick to using docker-compose v1 (that has been End of Life for several years now) with the docker_compose module, you have to make sure you use requests < 2.32.0.
Better use docker_compose_v2 though :)
I did, however, notice that i am using
community.docker.docker_compose
, which is deprecated (without deprecation warning on the docs),
FYI, the Ansible 9 docsite has been rebuilt, now it's also in the latest
docs: https://docs.ansible.com/ansible/latest/collections/community/docker/docker_compose_module.html#deprecated
@D0wn3r just to make sure, are you sure that you got the error with docker_host_info on community.docker 3.10.2? Or did you got it with some other modules, for example docker_swarm or dockerswarm*?
@felixfontein I will try but in my role, I launch a docker_host_info before any other docker_swarm*
I guess you are using community.docker before 3.10.2. (You only provided the community.general version.) Either upgrade community.docker to the latest version (it fixed this issue yesterday), or stick to
requests < 2.32.0
. Also please consider searching for similar error messages in the repository before creating a new issue the next time. You would have found two closed issues.# <path>/.ansible/collections/ansible_collections Collection Version ---------------- ------- community.docker 3.10.2
I'm using the latest version
In that case I have no idea what's going wrong in your case, since everything works both fine in CI and on my local machine with the latest requests.
Are you using a special way to talk to the Docker daemon, or are you using the default way (default Unix socket)?
I have nothing special. It's a fresh install. I will try more tests. I expected to fall on people that have the same issue
I tried again today and it works like a charm ... I close this issue so I don't know what did change since my last test. I'm not able to make it bugs
I suspect this is related to the latest patch release of requests, 2.32.2.
I've tested with the following: (Using both docker_host_info and docker_container, but the results are the same for both)
ansible [core 2.16.7] config file = None configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/local/lib/python3.11/site-packages/ansible ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections executable location = /usr/local/bin/ansible python version = 3.11.7 (/usr/bin/python3.11) jinja version = 3.1.4 libyaml = True
ansible-galaxy collection list ... community.docker 3.10.1 community.general 8.6.1 ...
On the managed node: pip list installed | grep docker docker 7.1.0
community.docker 3.10.1 only works with requests up to 2.32.1, it does not work with requests 2.32.2 and further. You need community.docker 3.10.2 for that.
Ahh, I was just installing everything with (basically) 'pip install ansible==9.6.0 ', which of course has 3.10.1 of community.docker. Then like an idiot I assumed I was using the latest and greatest.
Thank you for the clarification! :)
You unfortunately have to wait for Ansible 9.7.0 then, which should be there in a bit less than 3 weeks. Or wait for Ansible 10.0.0, which is likely out next Tuesday (assuming that no blockers show up). Ansible 10.0.0rc1 (released two days ago) already has community.docker 3.10.3.
Verified updating the community.docker
version resolved the issue for me.
In case someone is wondering how to do that:
ansible-galaxy collection install community.docker
Ansible 10.0.0 is out now btw (uploaded to PyPI 33 minutes ago =) ).
It looks like it was fixed in community.docker:3.10.2, current stable version is 3.10.3.
So we just need to upgrade community.docker version to latest, like that: ansible-galaxy collection install community.docker --upgrade
Ansible 10.0.0 is out now btw (uploaded to PyPI 33 minutes ago =) ).
Should we also update to 3.10.3 in Ansible 9 ? - https://github.com/ansible-community/ansible-build-data/blob/main/9/ansible-9.6.1.yaml#L89-L91 https://github.com/ansible-community/ansible-build-data/blob/main/9/ansible-9.build#L33
@bbezak the next regular Ansible 9 release (should be 9.7.0, and should be released in ~one week) will include it. Ansible 9.6.1 has been a hotfix for 9.6.0 to remove suspicious Windows binaries that were accidentally included in two collections. There was no other change in 9.6.1 compared to 9.6.0.
SUMMARY
I'm trying to get docker info through Ansible with the module
community.docker.docker_host_info
but it doesn't work anymore. It's on a fresh install (fresh ubuntu 22.04 with docker 26.0.X and also tried with 25.0.4)ISSUE TYPE
COMPONENT NAME
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Fresh instance ubuntu 22.04 from the cloud provider Scaleway
STEPS TO REPRODUCE
with docker_version: "5:25.0.4-1~ubuntu.20.04~focal"
EXPECTED RESULTS
I expect to get docker info
ACTUAL RESULTS
This error happened on my 3 servers