1

I am trying to build a container using ansible-container module on my Mac and running into the following issue.

Karthiks-MacBook-Pro:infrastructure karthikjayaraman$ ansible-container   build --roles-path=/Users/karthikjayaraman/roles
Building Docker Engine context...
Starting Docker build of Ansible Container Conductor image (please be patient)...
Parsing conductor CLI args.
Docker™ daemon integration engine loaded. Build starting.   project=infrastructure
Building service... project=infrastructure service=mdcsat
Traceback (most recent call last):
  File "/usr/bin/conductor", line 11, in <module>
    load_entry_point('ansible-container', 'console_scripts', 'conductor')()
  File "/_ansible/container/__init__.py", line 19, in __wrapped__
    return fn(*args, **kwargs)
  File "/_ansible/container/cli.py", line 399, in conductor_commandline
    **params)
  File "/_ansible/container/__init__.py", line 19, in __wrapped__
    return fn(*args, **kwargs)
  File "/_ansible/container/core.py", line 700, in conductorcmd_build
    cur_image_id = engine.get_image_id_by_tag(service['from'])
  File "/_ansible/container/docker/engine.py", line 549, in get_image_id_by_tag
    image = self.client.images.get(tag)
  File "/_ansible/container/docker/engine.py", line 164, in client
    self._client = docker.from_env(version='auto', timeout=timeout)
  File "/usr/lib/python2.7/site-packages/docker/client.py", line 80, in from_env
    **kwargs_from_env(**kwargs))
  File "/usr/lib/python2.7/site-packages/docker/client.py", line 37, in __init__
    self.api = APIClient(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/docker/api/client.py", line 147, in __init__
    self._version = self._retrieve_server_version()
  File "/usr/lib/python2.7/site-packages/docker/api/client.py", line 174, in _retrieve_server_version
    'Error while fetching server API version: {0}'.format(e)
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', error(2, 'No such file or directory'))
Conductor terminated. Cleaning up.  command_rc=1 conductor_id=6a4f7bcb46a33b8053d22af2ecc17abaa84abddf99f80f133b921546d36c76fc save_container=False
ERROR   Conductor exited with status 1

The build numbers of the components are as follows:

Karthiks-MacBook-Pro:infrastructure karthikjayaraman$ ansible --version
ansible 2.6.1
  config file = /Users/karthikjayaraman/mdc/mdc/tools/infrastructure/ansible.cfg
  configured module search path = [u'/Users/karthikjayaraman/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Library/Python/2.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.10 (default, Oct  6 2017, 22:29:07) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)]
Karthiks-MacBook-Pro:infrastructure karthikjayaraman$ docker --version
Docker version 18.03.1-ce, build 9ee9f40
Karthiks-MacBook-Pro:infrastructure karthikjayaraman$ ansible-container version
Ansible Container, version 0.9.2

Docker on my Mac is installed and running well.

Karthiks-MacBook-Pro:infrastructure karthikjayaraman$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

Any help appreciated !.

2
  • Seems to be permission problem, you need to be able to write to the docker socket to deal with docker daemon Commented Jul 18, 2018 at 17:16
  • Any pointers on how to do this ? The docker daemon seems to be running fine but the ansible-container module complains of something Commented Jul 18, 2018 at 18:59

1 Answer 1

2

Are you sure, you added your user account to the docker group? (your = account you run ansible-container under)

See here: https://docs.docker.com/engine/installation/linux/linux-postinstall/

Sign up to request clarification or add additional context in comments.

2 Comments

That was my first thought too but this issue is encountered in Docker on a Mac OS.
What getent group docker says ? Can you list current members of docker group? Also what is output of whoami ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.