Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker: doesn't work with requests-2.32.1 #256

Open
ollie1 opened this issue May 21, 2024 · 9 comments · May be fixed by #257
Open

Docker: doesn't work with requests-2.32.1 #256

ollie1 opened this issue May 21, 2024 · 9 comments · May be fixed by #257

Comments

@ollie1
Copy link

ollie1 commented May 21, 2024

A new version of the requests library has been released on pypi - https://pypi.org/project/requests/2.32.1/ . This seems incompatible with the docker molecule plugin. When trying to run molecule converge on a project using the docker plugin, I get a message as follows:

INFO     Sanity checks: 'docker'
CRITICAL Unable to contact the Docker daemon. Please refer to https://docs.docker.com/config/daemon/ for managing the daemon

Downgrading to a version of the requests library <2.32 resolves the issue and molecule works as normal:

python -m pip install 'requests<2.32'

Output of molecule --version

molecule 6.0.3 using python 3.9 
    ansible:2.15.12
    azure:23.5.3 from molecule_plugins
    containers:23.5.3 from molecule_plugins requiring collections: ansible.posix>=1.3.0 community.docker>=1.9.1 containers.podman>=1.8.1
    default:6.0.3 from molecule
    docker:23.5.3 from molecule_plugins requiring collections: community.docker>=3.4.11 ansible.posix>=1.4.0
    ec2:23.5.3 from molecule_plugins
    gce:23.5.3 from molecule_plugins requiring collections: google.cloud>=1.0.2 community.crypto>=1.8.0
    openstack:23.5.3 from molecule_plugins requiring collections: openstack.cloud>=2.1.0
    podman:23.5.3 from molecule_plugins requiring collections: containers.podman>=1.7.0 ansible.posix>=1.3.0
    vagrant:23.5.3 from molecule_plugins
@guidograzioli
Copy link

Same here with:

molecule 24.2.0 using python 3.11 
    ansible:2.17.0
    azure:23.5.3 from molecule_plugins
    containers:23.5.3 from molecule_plugins requiring collections: ansible.posix>=1.3.0 community.docker>=1.9.1 containers.podman>=1.8.1
    default:24.2.0 from molecule
    docker:23.5.3 from molecule_plugins requiring collections: community.docker>=3.4.11 ansible.posix>=1.4.0
    ec2:23.5.3 from molecule_plugins
    gce:23.5.3 from molecule_plugins requiring collections: google.cloud>=1.0.2 community.crypto>=1.8.0
    openstack:23.5.3 from molecule_plugins requiring collections: openstack.cloud>=2.1.0
    podman:23.5.3 from molecule_plugins requiring collections: containers.podman>=1.7.0 ansible.posix>=1.3.0
    vagrant:23.5.3 from molecule_plugins

guidograzioli added a commit to ansible-middleware/github-actions that referenced this issue May 22, 2024
guidograzioli added a commit to ansible-middleware/github-actions that referenced this issue May 22, 2024
guidograzioli added a commit to ansible-middleware/rhbk-datagrid-aws that referenced this issue May 22, 2024
@konstruktoid
Copy link
Contributor

konstruktoid commented May 22, 2024

@felixfontein
Copy link

Please make sure to install community.docker 3.10.2 or newer (right now that's the latest version). It contains a fix for this issue.

@mcdonnnj
Copy link

Please make sure to install community.docker 3.10.2 or newer (right now that's the latest version). It contains a fix for this issue.

I believe

def required_collections(self) -> dict[str, str]:
"""Return collections dict containing names and versions required."""
# https://galaxy.ansible.com/community/docker
return {"community.docker": "3.4.11", "ansible.posix": "1.4.0"}
is still a problem however.

@mcdonnnj mcdonnnj linked a pull request May 23, 2024 that will close this issue
@felixfontein
Copy link

Ouch, yes, if it forces community.docker to 3.4.11, then well, you're totally out of luck. Then you need to stick to requests < 2.32.0.

btravouillon added a commit to mila-iqia/ansible-role-cobbler that referenced this issue May 26, 2024
This is a temporary workaround for molecule+docker [1].

[1] ansible-community/molecule-plugins#256 (comment)
btravouillon added a commit to mila-iqia/ansible-role-cobbler that referenced this issue May 26, 2024
This is a temporary workaround for molecule+docker [1].

[1] ansible-community/molecule-plugins#256 (comment)
TheDevMinerTV added a commit to netresearch/ansible_role_docker_containers that referenced this issue Jun 4, 2024
TheDevMinerTV added a commit to netresearch/ansible_role_docker_containers that referenced this issue Jun 4, 2024
@jcox10
Copy link

jcox10 commented Jun 4, 2024

Installing the community.docker collection at 3.10.2 manually before running molecule seems to work around the issue. Molecule doesn't force downgrade thankfully.

@MaxBidlingmaier
Copy link

manually updating community.docker did not fix it for me, had to downgrade requests to 2.30.0 (2.31.0 did not work either)
So working config for me:
pip:

  • molecule==24.2.1
  • molecule-plugins[docker]== 23.5.3
  • requests==2.30.0
    Collections:
  • community.docker-3.10.2

Also tried:
pip:

  • molecule==24.6.0
  • molecule-plugins[docker]== 23.5.3
  • requests==2.31.0
    Collections:
  • community.docker-3.10.3

After updating above config to requests 2.32.0 issue reoccured

@felixfontein
Copy link

@MaxBidlingmaier which parts of community.docker are you using (and which aren't working for you)? If you are using the Swarm modules, you must upgrade Docker SDK for Python as well.

Also I have never heard of problems with requests 2.31.0 so far. What are the exact problems you have with it?

(Also note that requests 2.32.0 has been yanked from PyPI. You should either use a version before that, or after that.)

@MaxBidlingmaier
Copy link

MaxBidlingmaier commented Jun 7, 2024

@felixfontein : Just "normal" docker part (no swarm), see my molecule.yml below

 ---
dependency:
  name: galaxy
driver:
  name: docker
platforms:
  - name: "sles15sp4"
    image: somerepo:mytag
    pre_build_image: true
    tmpfs:
      - /run
      - /tmp
    volumes:
      - '/sys/fs/cgroup:/sys/fs/cgroup:ro'
    command: ""
    # NET_* capabilities required for iptables + ipset stuff
    capabilities:
      - SYS_ADMIN
      - NET_ADMIN
      - NET_RAW
provisioner:
  name: ansibl
verifier:
  name: ansible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants