Molecule: Molecule create throws error using Docker on macOS

Created on 16 Sep 2016  ·  7Comments  ·  Source: ansible-community/molecule

Using:

  • Python 2.7.12
  • Molecule 1.11.0
  • Docker 1.12.1 (Docker for Mac)
❯ molecule init foo --docker && cd foo
--> Initializing role foo...
Successfully initialized new role in /Users/yves.laroche/Desktop/foo...

~/Desktop/foo
❯ molecule create
--> Creating instances ...
Traceback (most recent call last):
  File "/usr/local/bin/molecule", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/molecule/cli.py", line 68, in main
    CLI().main()
  File "/usr/local/lib/python2.7/site-packages/molecule/cli.py", line 64, in main
    util.sysexit(c.execute()[0])
  File "/usr/local/lib/python2.7/site-packages/molecule/command/create.py", line 55, in execute
    self.molecule.driver.up(no_provision=True)
  File "/usr/local/lib/python2.7/site-packages/molecule/driver/dockerdriver.py", line 113, in up
    self._build_ansible_compatible_image()
  File "/usr/local/lib/python2.7/site-packages/molecule/driver/dockerdriver.py", line 216, in _build_ansible_compatible_image
    for tag in image.get('RepoTags')]
TypeError: 'NoneType' object is not iterable
bug

Most helpful comment

I deleted any image which showed <none> in either the repository or tag column of docker images output to get around this issue

All 7 comments

What version of docker-py is installed on your system? I can't reproduce this issue.

I'm running Docker Version 1.12.1-beta25 (build: 11807). Let me upgrade to beta26.

[jodewey:~/git/molecule]+ ± pip freeze | grep docker-py
You should consider upgrading via the 'pip install --upgrade pip' command.
❯  pip freeze | grep docker-py
docker-py==1.9.0
docker-pycreds==0.2.1

I can't reproduce. I've nuked my docker data dir too (~/Library/Containers/com.docker.docker/Data/). If you modify the following does that solve the problem? I can submit a hotfix if it does.

/usr/local/lib/python2.7/site-packages/molecule/driver/dockerdriver.py

from:

for tag in image.get('RepoTags')]

to:

for tag in image.get('RepoTags', [])]

I get the same problem.

❯ molecule create
--> Creating instances ...
Traceback (most recent call last):
  File "/usr/local/bin/molecule", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/molecule/cli.py", line 68, in main
    CLI().main()
  File "/usr/local/lib/python2.7/site-packages/molecule/cli.py", line 64, in main
    util.sysexit(c.execute()[0])
  File "/usr/local/lib/python2.7/site-packages/molecule/command/create.py", line 55, in execute
    self.molecule.driver.up(no_provision=True)
  File "/usr/local/lib/python2.7/site-packages/molecule/driver/dockerdriver.py", line 113, in up
    self._build_ansible_compatible_image()
  File "/usr/local/lib/python2.7/site-packages/molecule/driver/dockerdriver.py", line 216, in _build_ansible_compatible_image
    for tag in image.get('RepoTags', [])]
TypeError: 'NoneType' object is not iterable

Thanks, I have deleted my Docker data dir and it is working now.

👍 🎸

I deleted any image which showed <none> in either the repository or tag column of docker images output to get around this issue

Was this page helpful?
0 / 5 - 0 ratings