-
Notifications
You must be signed in to change notification settings - Fork 24k
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] docker-py naming conflict since 2.0.2 release #22993
Comments
Hi,
I have "pip install docker". There is no docker-py |
@alpeshspatel if you have previously installed
The code needs to be updated to reference the new Python Docker library name. |
Aborting. No time. |
Can someone explain why this issue has been closed? I'm running Ansible 2.3.1.0 on Ubuntu 16.04. I have installed the package python-docker (version 1.9), but when running a playbook with Docker, I get the error: I tried to remove the python-docker package and do So at the moment, I have no ways to use the Docker modules in Ansible! |
@jcberthon Are you still encountering this problem? |
@kassiansun I just ran into this using |
@sigmavirus24 Well, from docker-compose's requirements file, now it depends on |
So I don't even have
exception with - name: "Repro for 22993"
hosts: localhost
tasks:
- name: "Pull hello-world"
docker_image:
name: "hello-world" |
@sigmavirus24 What's the version of |
Actually I don't think ansible can run with |
Yeah, I run ansible on Python 3 enough that I don't think it's that. I started off with |
If you want to run ansible with python3, the git version is better(v2.4 is working on python3 support), and I'm running it on my python3 environment. |
Hi @kassiansun I forgot to update my comment. I found the problem. When I read the document it was written to install docker-py for dependency on the host that executes the module. That sentence was not clear to me and I installed docker-py on the host that executes the playbook (where I execute Now I understand that "executes the module" refer to the machine where the ansible module is actually executed, so those are the hosts defined in the playbook. After I added a pre-step which install on the remote hosts the docker-py dependency, then it worked. I guess the documentation could be less ambiguous. When you read it twice, you think it is on the host where you execute your playbook. After banging your head against a wall (it does help putting back some neurone in place ;-) ) and reading it a 3rd time, then you understand that it could be meant differently. So you try and you realise your mistake. I would suggest updating the documentation as follow:
|
@jcberthon Actually I think this is the source of this kind of problems, many people don't know how ansible works - copy the module to remote and execute it. And the Hope when people search for |
I found this problem today, in a bit weird way, with ansible 2.3.1.0 With given tasks:
the results are:
So, everything seems to be fine, but when next I run the task:
I get the Any ideas why reinstalling the Best, |
@szarlatan I had the same issue, comparing another environment I have, doing:
fixes the issue. I can now use again the module. Maybe a newer version works, I don't know. |
* Init dev * Testing * Add common/ufw/docker roles * Deleting staging/production files, not needed * Added basic files and simplified deploy * seperating local/remote deploys for testing. * Add some options for adding a docker user * Who likes typos? I do! * Focusing on local deploy * Syncing up initial deploy changes for testing * add ansible to upgrade ansible Inception? * fix install script * Install script modification * nginx-proxy role * Add certs * nginx-proxy labels * docker_user_id * add docker network * docker_network * more mods to nginx-proxy * run proxy as root to resolve issues * run * config * indents on role common * typos * this is a lot of commits * draft deploy site * more stuff! * getting there! * closer! * more! * remove user from wp container * add official wordpress image playbook * add user option and volume * Removed exposed ports, added purge_networks * destroy!!! * destroy (part deux) * conditionals in destroy * destroy? YES or yes * buhleted * add stop/start * stop/start * add borgbackup install * fix nginx-proxy id and borg ppa * stdout! * stdout2 * heh * docker pull * doit * docker-py confusion ansible/ansible#22993 * presents > present * reorganize structure * fix bash * cert destroy * removed docker-py 202aa93#commitcomment-25738710 * add symlink stuff * cancel symlinks, needs vars. fixed vars file * renames and making things nice for remote/local * dos2unix * lf * clean up, almost ready for master! * cleaning up! * sane defaults, cleaning, and modified deploy to save info * inventory defaults to localhost * Getting ready for Master Added README v1 * readme * destroy! * More readme changes * readyou * tl;dr * update gitignore
Has this been fixed for Ansible 2.5.0? I'm not too familiar with the docker APIs but I think that this PR, released in 2.5.0 may have fixed it: #36973 at least for many of the docker modules. needs_info |
@abadger no, it hasn't. Unfortunately I was just thinking about this earlier if there was a way we could detect it, and not sure that is possible, as it can manifest as an import error in some situations. Ultimately, you cannot have both Also, at this point |
<nod> but I thought the pr I linked to made it so docker-py did not need to
be installed anymore.
… |
@abadger yes, that is correct. You can have either However, you cannot have both python libraries installed at the same time. |
@dminca This issue is waiting for your response. Please respond or the issue will be closed. |
Since |
@dminca there is really no need. On another note, and I failed to come back to this issue, 2.6 (devel) and 2.5.3 will include extra protection around preventing If you have further questions please stop by IRC or the mailing list:
|
Hi!@jcberthon i got the same problem as yours. But i just have merely one machine (ubuntu 16.04), so i don't know how to solve it. Do you have any idea? |
Hi @huiminzeng Sorry for the long delay, I was away most of May and did not catch with all the emails notifications. If you have only one machine, then do you something like Basically, you need to install docker-py on the "destination" machine where you want your want your Docker commands to be executed. |
I ran into this same issue as well and tried to remove the docker python modules (with So, make sure to check both pip and pip2 if you run into this issue. |
Since the release of
docker
v2.0.2 bothdocker-py
anddocker
libs cannot reside together as it'll throw a naming conflict error.This change has already been applied in docker/docker-py#1399 in order to fix docker/docker-py#1395 docker/docker-py#1370 and last but not least docker/compose#4344 , thus
docker-compose
v1.10.1+ will require thedocker
lib instead of thedocker-py
one.ISSUE TYPE
COMPONENT NAME
docker_container
docker_image
docker_image_facts
docker_login
docker_network
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
"N/A"
SUMMARY
Possible naming conflict on the
docker-py
package since version2.0.2
will prevent user from keeping bothdocker-py
and the newdocker
libs.STEPS TO REPRODUCE
docker-engine
v1.13.1docker-compose
v1.11.2docker
viapip
moduleshell
orcommand
module, run adocker-compose up
on adocker-compose.yml
docker_container
moduleEXPECTED RESULTS
docker-compose.yml
via thecommand
orshell
module to lift up infrastructurerancher-agent
container via thedocker_container
moduleACTUAL RESULTS
Failed to import docker-py - No module named docker. Try "pip install docker-py"
docker
anddocker-py
cannot reside together sincedocker v2.0.2
docker-compose
will not function withdocker-py
since compose v1.10.1The text was updated successfully, but these errors were encountered: