-
Notifications
You must be signed in to change notification settings - Fork 24
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
bug: #150
Comments
Thank you for reporting this bug. Which version of Docker are you running? Any chance the bug is related to this issue? |
I am running docker desktop 4.14.1. It is related to that bug. HEre are some steps I took to make some progress from that report. First get the client context from:
Next, find the endpoint:
Then, I ran this:
you could also export that env var so it works normally.
after that, the colrev commands seem to work fine. |
Thank you. It's good to know that the env var export fixes the issue. Do you think we should wait for Docker Desktop to fix the bug, or should we try to catch and address it more properly in colrev? Glad to see that the other commands work! |
I sort of feel you should just document this, and wait for docker to fix it. I don't know if it would be easy to fix, here is a small proof of concept code that might work using the shell command. I am not sure you can set the env var like this in python, and make it work, but it could be a little utility that helps people know what to set it to. import json
import os
import subprocess
p = subprocess.run(['docker', 'context', 'ls', '--format=json'], capture_output=True)
endpoint = None
for entry in json.loads(p.stdout):
if entry['Current']:
endpoint = entry['DockerEndpoint']
break
if endpoint:
os.environ['DOCKER_HOST'] = endpoint I assume the current context is the right one, but you could also check that its name matches this output:
|
Thank you for the proof of concept code. It should be very useful for others who encounter the same issue. |
Bug Report
colrev version:
colrev version
colrev version 0.8.0
Current behavior:
Docker is not found when running
colrev init
. Docker is installed and running (Mac OS).Expected behavior:
I would expect Docker to be found.
Steps to reproduce:
run
colrev init
in an empty directory on a Mac.Related code:
Python 3.8.11 (default, Aug 6 2021, 08:56:27)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/jkitchin/opt/anaconda3/lib/python3.8/site-packages/requests/adapters.py", line 489, in send
resp = conn.urlopen(
File "/Users/jkitchin/opt/anaconda3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "/Users/jkitchin/opt/anaconda3/lib/python3.8/site-packages/urllib3/util/retry.py", line 532, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/Users/jkitchin/opt/anaconda3/lib/python3.8/site-packages/urllib3/packages/six.py", line 769, in reraise
raise value.with_traceback(tb)
File "/Users/jkitchin/opt/anaconda3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/Users/jkitchin/opt/anaconda3/lib/python3.8/site-packages/urllib3/connectionpool.py", line 394, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/Users/jkitchin/opt/anaconda3/lib/python3.8/http/client.py", line 1256, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Users/jkitchin/opt/anaconda3/lib/python3.8/http/client.py", line 1302, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Users/jkitchin/opt/anaconda3/lib/python3.8/http/client.py", line 1251, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Users/jkitchin/opt/anaconda3/lib/python3.8/http/client.py", line 1011, in _send_output
self.send(msg)
File "/Users/jkitchin/opt/anaconda3/lib/python3.8/http/client.py", line 951, in send
self.connect()
File "/Users/jkitchin/opt/anaconda3/lib/python3.8/site-packages/docker/transport/unixconn.py", line 30, 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/jkitchin/opt/anaconda3/lib/python3.8/site-packages/docker/api/client.py", line 214, in _retrieve_server_version
return self.version(api_version=False)["ApiVersion"]
File "/Users/jkitchin/opt/anaconda3/lib/python3.8/site-packages/docker/api/daemon.py", line 181, in version
return self._result(self._get(url), json=True)
File "/Users/jkitchin/opt/anaconda3/lib/python3.8/site-packages/docker/utils/decorators.py", line 46, in inner
return f(self, *args, **kwargs)
File "/Users/jkitchin/opt/anaconda3/lib/python3.8/site-packages/docker/api/client.py", line 237, in _get
return self.get(url, **self._set_request_timeout(kwargs))
File "/Users/jkitchin/opt/anaconda3/lib/python3.8/site-packages/requests/sessions.py", line 600, in get
return self.request("GET", url, **kwargs)
File "/Users/jkitchin/opt/anaconda3/lib/python3.8/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/Users/jkitchin/opt/anaconda3/lib/python3.8/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "/Users/jkitchin/opt/anaconda3/lib/python3.8/site-packages/requests/adapters.py", line 547, 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 "", line 1, in
File "/Users/jkitchin/opt/anaconda3/lib/python3.8/site-packages/docker/client.py", line 96, in from_env
return cls(
File "/Users/jkitchin/opt/anaconda3/lib/python3.8/site-packages/docker/client.py", line 45, in init
self.api = APIClient(*args, **kwargs)
File "/Users/jkitchin/opt/anaconda3/lib/python3.8/site-packages/docker/api/client.py", line 197, in init
self._version = self._retrieve_server_version()
File "/Users/jkitchin/opt/anaconda3/lib/python3.8/site-packages/docker/api/client.py", line 221, in _retrieve_server_version
raise DockerException(
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
Docker desktop is running.
The text was updated successfully, but these errors were encountered: