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-py package breaks using docker-compose #743

Closed
timja opened this issue Feb 6, 2017 · 10 comments
Closed

docker-py package breaks using docker-compose #743

timja opened this issue Feb 6, 2017 · 10 comments

Comments

@timja
Copy link

timja commented Feb 6, 2017

Issue Type

  • Bug report

Molecule and Ansible details

  • Molecule installation method: One of source, pip
    pip
  • Ansible installation method: One of source, pip, OS package
    os package

Desired Behaviour

I can use docker-compose and molecule on the same machine

Actual Behaviour (Bug report only)

Installing docker-py conflicts with the new package docker

Traceback (most recent call last):
  File "/bin/docker-compose", line 7, in <module>
    from compose.cli.main import main
  File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 20, in <module>
    from ..bundle import get_image_digests
  File "/usr/lib/python2.7/site-packages/compose/bundle.py", line 13, in <module>
    from .network import get_network_defs_for_service
  File "/usr/lib/python2.7/site-packages/compose/network.py", line 7, in <module>
    from docker.types import IPAMConfig
ImportError: cannot import name IPAMConfig

See:
docker/compose#4401
docker/docker-py#1431

docker-py appears to be obsoleted and docker is the new pip package

@abtreece
Copy link
Contributor

abtreece commented Feb 7, 2017

Docker changed the name of the Docker Python SDK to just docker when they bumped to version 2. The last docker-py version is 1.10.6. Molecule is only capable of using docker-py due to changes that have been made to the API in v2. AFAIK we won't be supporting the v2 docker b/c molecule is going to transition to using the Ansible implementation of Docker.

As you've discovered you can't have both docker-py and docker installed which is by design by Docker.

@abtreece
Copy link
Contributor

abtreece commented Feb 7, 2017

Thinking about this more... in order to use docker-compose and molecule together you will likely need to install docker-compose via a method other than pip. On a Mac or Windows machine docker-compose comes with the installation of Docker Engine. You can also pull down the docker-compose binary by itself via a curl command documented here... https://docs.docker.com/compose/install/

@retr0h
Copy link
Contributor

retr0h commented Feb 7, 2017

AFAIK we won't be supporting the v2 docker b/c molecule is going to transition to using the Ansible implementation of Docker.

Also, the Ansible 2.2 docker_ modules require docker-py, so I probably wont be spending effort porting Molecule v1 to the docker pip package.

@retr0h
Copy link
Contributor

retr0h commented Feb 7, 2017

Thinking about this more... in order to use docker-compose and molecule together you will likely need to install docker-compose via a method other than pip. On a Mac or Windows machine docker-compose comes with the installation of Docker Engine. You can also pull down the docker-compose binary by itself via a curl command documented here... https://docs.docker.com/compose/install/

Good point as well. I can run Molecule and the entire docker toolchain, since I have installed docker using the Docker installer. Not through pip.

@retr0h
Copy link
Contributor

retr0h commented Feb 8, 2017

Won't be moving to docker anytime soon. See workarounds above.

@retr0h retr0h closed this as completed Feb 8, 2017
@timja
Copy link
Author

timja commented Feb 13, 2017

In case anyone is interested ansible devel branch supports both docker-py and docker
Here is the commit that introduced support:
ansible/ansible@e2a1ce2

@timja
Copy link
Author

timja commented Mar 8, 2017

@abtreece @retr0h The workaround of installing the compose binary from somewhere other than pip no longer works.

docker-compose has added a check to see if docker-py exists and fails fast with:

ERROR: Dependency conflict: an older version of the 'docker-py' package is polluting the namespace. Run the following command to remedy the issue:
pip uninstall docker docker-py; pip install docker

Is there another workaround?

@retr0h
Copy link
Contributor

retr0h commented Mar 8, 2017

Is there another workaround?

Run molecule in a virtualenv? Since the bug report is about running docker-compose and molecule on the same system, you simply need to run molecule in a venv.

@retr0h
Copy link
Contributor

retr0h commented Mar 9, 2017

@kireledan Would you be interested in porting Molecule to the new docker package vs docker-py?

@kireledan
Copy link
Contributor

Sure. I'll take a look

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

No branches or pull requests

4 participants