community.docker
community.docker copied to clipboard
community.docker.docker_compose failed with Docker SDK for Python 7.0.0 (Released: Dec 8, 2023)
SUMMARY
community.docker.docker_compose fails to run my containers with Docker SDK for Python 7.0.0 (Released: Dec 8, 2023).
The error is related to a function call to "kwargs from_env()" which is passed an argument called "ssl_version" which the function no longer recognizes or supports.
Everything works with the penultimate stable version (Docker SDK for Python: 6.1.3).
ISSUE TYPE
- Bug Report
COMPONENT NAME
community.docker.docker_compose
ANSIBLE VERSION
ansible 2.10.8
config file = /home/vagrant/ansible.cfg
configured module search path = ['/home/vagrant/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
COLLECTION VERSION
none
CONFIGURATION
DEFAULT_HOST_LIST(/home/vagrant/ansible.cfg) = ['/home/vagrant/inventory']
DEFAULT_PRIVATE_KEY_FILE(/home/vagrant/ansible.cfg) = /home/vagrant/.ssh/ansible
OS / ENVIRONMENT
Linux 5.15.0-83-generic #92-Ubuntu SMP Mon Aug 14 09:30:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
STEPS TO REPRODUCE
Run this yaml in an Ubuntu 22.04 vagrant VM to install the packages and build up /app/docker/docker_compose.yml
- hosts: servers
become: true
tasks:
- name: install dependencies
tags: docker, boot
apt:
name:
- apt-transport-https
- ca-certificates
- curl
- gnupg-agent
- software-properties-common
- python3-pip
- virtualenv
- python3-setuptools
state: present
update_cache: yes
- name: add docker GPG key
tags: docker, boot
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: add docker repository to apt
tags: docker, boot
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu jammy stable
state: present
- name: install Docker
tags: docker, boot
apt:
name:
- docker-ce
state: present
update_cache: yes
- name: install docker module for python
tags: docker, boot
pip:
name:
- docker == 7.0.0
- docker-compose >= 1.7.0, < 2.0.0
- name: build images and up containers
tags: docker, up
docker_compose:
project_src: /app/docker
state: present
EXPECTED RESULTS
My containers defined in /app/docker/docker_compose.yml are up.
ACTUAL RESULTS
The full traceback is:
File "/tmp/ansible_docker_compose_payload_ekkjzyn7/ansible_docker_compose_payload.zip/ansible_collections/community/general/plugins/modules/docker_compose.py", line 670, in __init__
File "/usr/local/lib/python3.10/dist-packages/compose/cli/command.py", line 60, in project_from_options
return get_project(
File "/usr/local/lib/python3.10/dist-packages/compose/cli/command.py", line 152, in get_project
client = get_client(
File "/usr/local/lib/python3.10/dist-packages/compose/cli/docker_client.py", line 41, in get_client
client = docker_client(
File "/usr/local/lib/python3.10/dist-packages/compose/cli/docker_client.py", line 124, in docker_client
kwargs = kwargs_from_env(environment=environment, ssl_version=tls_version)
fatal: [192.168.56.111]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"api_version": "auto",
"build": false,
"ca_cert": null,
"client_cert": null,
"client_key": null,
"debug": false,
"definition": null,
"dependencies": true,
"docker_host": "unix://var/run/docker.sock",
"files": null,
"hostname_check": false,
"nocache": false,
"project_name": null,
"project_src": "/app/docker",
"pull": false,
"recreate": "smart",
"remove_images": null,
"remove_orphans": false,
"remove_volumes": false,
"restarted": false,
"scale": null,
"services": null,
"ssl_version": null,
"state": "present",
"stopped": false,
"timeout": 10,
"tls": false,
"tls_hostname": "localhost",
"validate_certs": false
}
},
"msg": "Configuration error - kwargs_from_env() got an unexpected keyword argument 'ssl_version'"
}