Ask questionsrequests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
Here is the full traceback:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 354, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python3.6/http/client.py", line 1254, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1300, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1249, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1036, in _send_output
self.send(msg)
File "/usr/lib/python3.6/http/client.py", line 974, in send
self.connect()
File "/usr/local/lib/python3.6/dist-packages/docker/transport/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 "/usr/local/lib/python3.6/dist-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/local/lib/python3.6/dist-packages/urllib3/util/retry.py", line 368, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/local/lib/python3.6/dist-packages/urllib3/packages/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 354, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python3.6/http/client.py", line 1254, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1300, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1249, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1036, in _send_output
self.send(msg)
File "/usr/lib/python3.6/http/client.py", line 974, in send
self.connect()
File "/usr/local/lib/python3.6/dist-packages/docker/transport/unixconn.py", line 43, 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 "main.py", line 78, in <module>
main()
File "main.py", line 32, in main
docker_client.login(username=docker_username, password=docker_password)
File "/usr/local/lib/python3.6/dist-packages/docker/client.py", line 183, in login
return self.api.login(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/docker/api/daemon.py", line 149, in login
response = self._post_json(self._url('/auth'), data=req_data)
File "/usr/local/lib/python3.6/dist-packages/docker/api/client.py", line 289, in _post_json
return self._post(url, data=json.dumps(data2), **kwargs)
File "/usr/local/lib/python3.6/dist-packages/docker/utils/decorators.py", line 46, in inner
return f(self, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/docker/api/client.py", line 226, in _post
return self.post(url, **self._set_request_timeout(kwargs))
File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 581, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/requests/adapters.py", line 498, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
So I am trying to log into docker hub using this package. The python script running this is running in a docker container. Below is the Dockerfile:
# Base image with docker and python3.6 installed
FROM mattgleich/python-and-docker
# Image metadata
LABEL maintainer="[email protected]"
LABEL description="Automatically build images anywhere that docker runs"
# Installing Git
RUN apt-get update
RUN apt-get -qq -y install git
# Installing requirements
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
RUN export GIT_PYTHON_REFRESH=quiet
COPY /src /src
WORKDIR /src
RUN rm -rf repos
# Fixing some stuff with docker
RUN eval "$(docker-machine env default)"
CMD [ "python3", "main.py" ]
The docker hub password is stored in a folder called configs that is then put into the container using a volume. Below is the error that I get when I start the container with docker compose:
version: "3"
services:
auto-build-images:
container_name: auto-build-images
build: .
network_mode: "host"
volumes:
- ~/auto-build-images-config:/src/config
As far as the script goes, below is a link to the GitHub repo for the project: https://github.com/Matt-Gleich/Auto-Build-Images-Anywhere
Answer questions
shin-
RUN eval "$(docker-machine env default)" will not persist these environment values at runtime. You'll need a startup script.
I'm going to close this as it's not related to the SDK.
Related questions