Consider handling docker client init errors
See original GitHub issueI tried to run the command
$ jupyter-repo2docker --no-run --image-name test/test:1.0 https://github.com/jakevdp/PythonDataScienceHandbook
I got a long exception traceback like so
Cloning into '/var/folders/sd/2vfz67290916z1dlgy00jv700000gn/T/repo2dockeryhkrx5g8'...
remote: Counting objects: 1623, done.
remote: Total 1623 (delta 0), reused 0 (delta 0), pack-reused 1623
Receiving objects: 100% (1623/1623), 96.08 MiB | 5.80 MiB/s, done.
Resolving deltas: 100% (1139/1139), done.
Using repo2docker-python3.5 builder
Traceback (most recent call last):
File "/workspace/py3Env/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
chunked=chunked)
File "/workspace/py3Env/lib/python3.6/site-packages/urllib3/connectionpool.py", line 357, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/Library/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 "/Library/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 "/Library/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 "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/workspace/py3Env/lib/python3.6/site-packages/docker/transport/unixconn.py", line 46, in connect
sock.connect(self.unix_socket)
ConnectionRefusedError: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/workspace/py3Env/lib/python3.6/site-packages/requests/adapters.py", line 440, in send
timeout=timeout
File "/workspace/py3Env/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "/workspace/py3Env/lib/python3.6/site-packages/urllib3/util/retry.py", line 357, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/workspace/py3Env/lib/python3.6/site-packages/urllib3/packages/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/workspace/py3Env/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
chunked=chunked)
File "/workspace/py3Env/lib/python3.6/site-packages/urllib3/connectionpool.py", line 357, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/Library/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 "/Library/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 "/Library/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 "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/workspace/py3Env/lib/python3.6/site-packages/docker/transport/unixconn.py", line 46, in connect
sock.connect(self.unix_socket)
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionRefusedError(61, 'Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/workspace/py3Env/lib/python3.6/site-packages/docker/api/client.py", line 168, in _retrieve_server_version
return self.version(api_version=False)["ApiVersion"]
File "/workspace/py3Env/lib/python3.6/site-packages/docker/api/daemon.py", line 177, in version
return self._result(self._get(url), json=True)
File "/workspace/py3Env/lib/python3.6/site-packages/docker/utils/decorators.py", line 46, in inner
return f(self, *args, **kwargs)
File "/workspace/py3Env/lib/python3.6/site-packages/docker/api/client.py", line 191, in _get
return self.get(url, **self._set_request_timeout(kwargs))
File "/workspace/py3Env/lib/python3.6/site-packages/requests/sessions.py", line 521, in get
return self.request('GET', url, **kwargs)
File "/workspace/py3Env/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/workspace/py3Env/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "/workspace/py3Env/lib/python3.6/site-packages/requests/adapters.py", line 490, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionRefusedError(61, 'Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/workspace/py3Env/bin/jupyter-repo2docker", line 11, in <module>
load_entry_point('jupyter-repo2docker', 'console_scripts', 'jupyter-repo2docker')()
File "/workspace/py3Env/workspace/repo2docker/repo2docker/__main__.py", line 6, in main
f.start()
File "/workspace/py3Env/workspace/repo2docker/repo2docker/app.py", line 394, in start
for l in picked_buildpack.build(self.output_image_spec, self.build_memory_limit):
File "/workspace/py3Env/workspace/repo2docker/repo2docker/buildpacks/base.py", line 404, in build
**docker.utils.kwargs_from_env())
File "/workspace/py3Env/lib/python3.6/site-packages/docker/api/client.py", line 149, in __init__
self._version = self._retrieve_server_version()
File "/workspace/py3Env/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.', ConnectionRefusedError(61, 'Connection refused'))
Though by parsing through the error callback, it is clearly visible that docker has not been started in my computer, it is not readily apparent that it is an issue with docker during client initialization.
Can this exception be handled by a try/except block during APIClient init and a nicer message printed out while the traceback is printed on the --debug flag being enabled?
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Errors running up · Issue #7896 · docker/compose - GitHub
Hello, when I run docker compose up I get the following errors : $ docker-compose up -d Traceback (most recent call last): File ......
Read more >Troubleshooting errors with Docker commands when using ...
Use the docker images command to see a list of all locally downloaded Docker images, along with their sizes. Client cannot connect to...
Read more >Errors connecting to Docker socket (#2408) - gitlab-runner
For me the ERROR: Job failed (system failure): Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Read more >Docker Failed to Initialize on Windows - Stack Overflow
The error message I got was not exactly the same the OP got. For me, it said Docker failed to initialize. Docker Desktop...
Read more >Overview | Docker Documentation
This page contains information on: How to diagnose and troubleshoot Docker Desktop issues; Check the logs; Find workarounds for common problems ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Since we use subprocess to call r2d in most of our tests, we can just set the environment variable for the one test we need to test it for. That way it’s not travis specific.
On Tue, Jan 9, 2018 at 1:59 PM, Tim Head notifications@github.com wrote:
– Yuvi Panda T http://yuvi.in/blog
One thing we need to be quite sure about is that we restore it to the correct value “no matter what”. Or at least leave a big big warning to our future selves explaining why potentially completely weird stuff is happening to tests after this test.