tmpnb
tmpnb copied to clipboard
Launching tmpnb on EC2 - ConnectionRefusedError in docker logs
Edit: I have it working with docker-compose and the .yml config, but would like to understand what happened with socket connection refused issue.
Hi Jupyter team! Complete Docker newbie here in action (trying to deploy an automated tmpnb environment for PyLadies) - so please be patient! I am trying to deploy tmbnb on a t2.micro EC2 instance running Ubuntu. I have run the following three commands from the tutorial
docker pull jupyter/minimal-notebook
export TOKEN=$( head -c 30 /dev/urandom | xxd -p )
docker run --net=host -d -e CONFIGPROXY_AUTH_TOKEN=$TOKEN --name=proxy jupyter/configurable-http-proxy --default-target http://127.0.0.1:9999
docker run --net=host -d -e CONFIGPROXY_AUTH_TOKEN=$TOKEN --name=tmpnb -v /var/run/docker.sock:/docker.sock jupyter/tmpnb python orchestrate.py --container-user=jovyan --command='jupyter notebook --no-browser --port {port} --ip=0.0.0.0 --NotebookApp.base_url=/{base_path} --NotebookApp.port_retries=0 --NotebookApp.token="" --NotebookApp.disable_check_xsrf=True'
However, the tmpnb docker logs are showing the following errors:
Traceback (most recent call last):
File "orchestrate.py", line 504, in <module>
main()
File "orchestrate.py", line 426, in main
assert_hostname=opts.assert_hostname,
File "/srv/tmpnb/dockworker.py", line 68, in __init__
**kwargs)
File "/usr/local/lib/python3.4/site-packages/docker/client.py", line 77, in __init__
self._version = self._retrieve_server_version()
File "/usr/local/lib/python3.4/site-packages/docker/client.py", line 97, 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(111, 'Connection refused'))
Traceback (most recent call last):
File "/usr/local/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 356, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/lib/python3.4/http/client.py", line 1137, in request
self._send_request(method, url, body, headers)
File "/usr/local/lib/python3.4/http/client.py", line 1182, in _send_request
self.endheaders(body)
File "/usr/local/lib/python3.4/http/client.py", line 1133, in endheaders
self._send_output(message_body)
File "/usr/local/lib/python3.4/http/client.py", line 963, in _send_output
self.send(msg)
File "/usr/local/lib/python3.4/http/client.py", line 898, in send
self.connect()
File "/usr/local/lib/python3.4/site-packages/docker/unixconn/unixconn.py", line 41, in connect
sock.connect(self.unix_socket)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/site-packages/requests/adapters.py", line 423, in send
timeout=timeout
File "/usr/local/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 649, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/local/lib/python3.4/site-packages/requests/packages/urllib3/util/retry.py", line 347, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/local/lib/python3.4/site-packages/requests/packages/urllib3/packages/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 356, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/lib/python3.4/http/client.py", line 1137, in request
self._send_request(method, url, body, headers)
File "/usr/local/lib/python3.4/http/client.py", line 1182, in _send_request
self.endheaders(body)
File "/usr/local/lib/python3.4/http/client.py", line 1133, in endheaders
self._send_output(message_body)
File "/usr/local/lib/python3.4/http/client.py", line 963, in _send_output
self.send(msg)
File "/usr/local/lib/python3.4/http/client.py", line 898, in send
self.connect()
File "/usr/local/lib/python3.4/site-packages/docker/unixconn/unixconn.py", line 41, in connect
sock.connect(self.unix_socket)
requests.packages.urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionRefusedError(111, 'Connection refused'))
My user has been added to the docker group and I've checked the owner of the file /var/run/docker.sock. It was root:docker. In a vain attempt to fix this I tried changing the owner of docker.dock to ubuntu, but that did not work. Unfortunately, searching for answers has not resulted in anything fruitful. All tips/comments/help will be super super appreciated!
Edit: I should add that I've run basic docker examples such as
docker run hello-world
and they do work ok.