ansible / ansible-container

DEPRECATED -- Ansible Container was a tool to build Docker images and orchestrate containers using only Ansible playbooks.
GNU Lesser General Public License v3.0
2.19k stars 392 forks source link

FileNotFoundError: [Errno 2] No such file or directory #844

Closed cahi closed 6 years ago

cahi commented 6 years ago
ISSUE TYPE
container.yml
version: "2"
settings:
  conductor_base: centos:7
defaults:
  POSTGRES_USER: django
  POSTGRES_PASSWORD: sesame
  POSTGRES_DB: django
  DJANGO_PORT: 8080
services:
  django:
    from: centos:7
    roles:
      - django-gunicorn
    environment:
      DATABASE_URL: "pgsql://{{ POSTGRES_USER }}:{{ POSTGRES_PASSWORD }}@postgres:5432/{{ POSTGRES_DB }}"
      DJANGO_ROOT: '{{ DJANGO_ROOT }}'
      DJANGO_VENV: '{{ DJANGO_VENV }}'
    links:
    - postgres
    - postgres:postgresql
    ports:
    - '{{ DJANGO_PORT }}'
    working_dir: '{{ DJANGO_ROOT }}'
    user: '{{ DJANGO_USER }}'
    command: ['{{ DJANGO_VENV }}/bin/gunicorn', '-w', '2', '-b', '0.0.0.0:{{ DJANGO_PORT }}', 'project.wsgi:application']
    entrypoint: ['/usr/bin/dumb-init', '/usr/bin/entrypoint.sh']
    volumes:
      - 'static:{{ DJANGO_ROOT }}'
    dev_overrides:
      command: ['{{ DJANGO_VENV }}/bin/python', 'manage.py', 'runserver', '0.0.0.0:{{ DJANGO_PORT }}']
      volumes:
      - '${PWD}:{{ DJANGO_ROOT }}'
      - "static:/static"
      expose:
      - "{{ DJANGO_PORT }}"
      environment:
        DEBUG: "1"
  nginx:
    from: centos:7
    roles:
    - nginx
    ports:
    - '{{ DJANGO_PORT }}:8000'
    user: nginx
    links:
    - django
    command: ['/usr/bin/dumb-init', 'nginx', '-c', '/etc/nginx/nginx.conf']
    volumes:
    - 'static:{{ STATIC_ROOT }}'
    dev_overrides:
      ports: []
      command: /bin/false
      volumes: []
  postgres:
    from: postgres:9.6
    environment:
      POSTGRES_USER: "{{ POSTGRES_USER }}"
      POSTGRES_PASSWORD: "{{ POSTGRES_PASSWORD }}"
      POSTGRES_DB: "{{ POSTGRES_DB }}"
volumes:
  static:
    docker: {}
registries: {}
OS / ENVIRONMENT
Ansible Container, version 0.9.2
Darwin, MacBook-Pro.localdomain, 17.3.0, Darwin Kernel Version 17.3.0: Thu Nov  9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64, x86_64
3.6.4 (default, Dec 25 2017, 14:57:56) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] /Users/chilber/ansible-play/ansible-container/bin/python3.6
ERROR   Unknown exception Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))   
Traceback (most recent call last):
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/urllib3/connectionpool.py", line 357, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send
    self.connect()
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/docker/transport/unixconn.py", line 46, in connect
    sock.connect(self.unix_socket)
FileNotFoundError: [Errno 2] No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/urllib3/util/retry.py", line 357, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/urllib3/packages/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/urllib3/connectionpool.py", line 357, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send
    self.connect()
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/docker/transport/unixconn.py", line 46, in connect
    sock.connect(self.unix_socket)
urllib3.exceptions.ProtocolError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/docker/api/client.py", line 168, in _retrieve_server_version
    return self.version(api_version=False)["ApiVersion"]
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/docker/api/daemon.py", line 177, in version
    return self._result(self._get(url), json=True)
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/docker/utils/decorators.py", line 46, in inner
    return f(self, *args, **kwargs)
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/docker/api/client.py", line 191, in _get
    return self.get(url, **self._set_request_timeout(kwargs))
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/requests/sessions.py", line 521, in get
    return self.request('GET', url, **kwargs)
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/requests/adapters.py", line 490, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/container/cli.py", line 299, in __call__
    getattr(core, u'hostcmd_{}'.format(args.subcommand))(**vars(args))
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/container/__init__.py", line 28, in __wrapped__
    return fn(*args, **kwargs)
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/container/core.py", line 465, in hostcmd_version
    engine_obj.print_version_info()
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/container/__init__.py", line 28, in __wrapped__
    return fn(*args, **kwargs)
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/container/docker/engine.py", line 255, in print_version_info
    print(json.dumps(self.client.info(), indent=2))
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/container/docker/engine.py", line 164, in client
    self._client = docker.from_env(version='auto', timeout=timeout)
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/docker/client.py", line 81, in from_env
    **kwargs_from_env(**kwargs))
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/docker/client.py", line 38, in __init__
    self.api = APIClient(*args, **kwargs)
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/docker/api/client.py", line 149, in __init__
    self._version = self._retrieve_server_version()
  File "/Users/chilber/ansible-play/ansible-container/lib/python3.6/site-packages/docker/api/client.py", line 176, in _retrieve_server_version
    'Error while fetching server API version: {0}'.format(e)
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
SUMMARY

I tried the getting started guide without chnging anything. Seems like the installation of ansible-container is broken, as the error messages are the same when executing 'ansible-container --debug version'

STEPS TO REPRODUCE

'ansible-container --debug version'

'ansible-container --debug version'
EXPECTED RESULTS
ACTUAL RESULTS
cahi commented 6 years ago

docker was installed wrong, thats why. This issue helped me to resolve it: https://github.com/openai/universe/issues/52