bcsaller / layercake

Service Discovery and configuration with schema and rules
Apache License 2.0
3 stars 4 forks source link

Support reading $DOCKER_HOST * from env #1

Open lazypower opened 8 years ago

lazypower commented 8 years ago

There are a slew of docker env vars that help control the docker tooling. most notably being:

DOCKER_TLS_VERIFY DOCKER_HOST DOCKER_CERT_PATH

this configures the client side tooling. I noticed we're using dockerpy, and its throwing the stack attempting to contact the socket which doesn't exist if you're using boot2docker/docker-machine

$ cake bake
Traceback (most recent call last):
  File "/Users/charles/projects/work/disco/.venv/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 578, in urlopen
    chunked=chunked)
  File "/Users/charles/projects/work/disco/.venv/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 362, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1106, in request
    self._send_request(method, url, body, headers)
  File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1151, in _send_request
    self.endheaders(body)
  File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1102, in endheaders
    self._send_output(message_body)
  File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 934, in _send_output
    self.send(msg)
  File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 877, in send
    self.connect()
  File "/Users/charles/projects/work/disco/.venv/lib/python3.5/site-packages/docker/unixconn/unixconn.py", line 43, 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/charles/projects/work/disco/.venv/lib/python3.5/site-packages/requests/adapters.py", line 403, in send
    timeout=timeout
  File "/Users/charles/projects/work/disco/.venv/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 623, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/Users/charles/projects/work/disco/.venv/lib/python3.5/site-packages/requests/packages/urllib3/util/retry.py", line 255, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/Users/charles/projects/work/disco/.venv/lib/python3.5/site-packages/requests/packages/urllib3/packages/six.py", line 309, in reraise
    raise value.with_traceback(tb)
  File "/Users/charles/projects/work/disco/.venv/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 578, in urlopen
    chunked=chunked)
  File "/Users/charles/projects/work/disco/.venv/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 362, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1106, in request
    self._send_request(method, url, body, headers)
  File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1151, in _send_request
    self.endheaders(body)
  File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1102, in endheaders
    self._send_output(message_body)
  File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 934, in _send_output
    self.send(msg)
  File "/usr/local/Cellar/python3/3.5.2/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 877, in send
    self.connect()
  File "/Users/charles/projects/work/disco/.venv/lib/python3.5/site-packages/docker/unixconn/unixconn.py", line 43, in connect
    sock.connect(self.unix_socket)
requests.packages.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/charles/projects/work/disco/.venv/bin/cake", line 11, in <module>
    sys.exit(main())
  File "/Users/charles/projects/work/disco/.venv/lib/python3.5/site-packages/layer_cake/cake.py", line 303, in main
    options.func(options)
  File "/Users/charles/projects/work/disco/.venv/lib/python3.5/site-packages/layer_cake/cake.py", line 248, in bake_main
    response = client.build(fileobj=f, tag="layercake/disco")
  File "/Users/charles/projects/work/disco/.venv/lib/python3.5/site-packages/docker/api/build.py", line 104, in build
    timeout=timeout,
  File "/Users/charles/projects/work/disco/.venv/lib/python3.5/site-packages/docker/utils/decorators.py", line 47, in inner
    return f(self, *args, **kwargs)
  File "/Users/charles/projects/work/disco/.venv/lib/python3.5/site-packages/docker/client.py", line 116, in _post
    return self.post(url, **self._set_request_timeout(kwargs))
  File "/Users/charles/projects/work/disco/.venv/lib/python3.5/site-packages/requests/sessions.py", line 518, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/Users/charles/projects/work/disco/.venv/lib/python3.5/site-packages/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/charles/projects/work/disco/.venv/lib/python3.5/site-packages/requests/sessions.py", line 585, in send
    r = adapter.send(request, **kwargs)
  File "/Users/charles/projects/work/disco/.venv/lib/python3.5/site-packages/requests/adapters.py", line 453, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))