Can't pull image from ECR after successfully logging in.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.7k
- Avg merge
- 13d 8h
- Merged PRs (30d)
- 2
Description
I saw this previous closed issue which is almost what is happening to me:
https://github.com/docker/docker-py/issues/2157
However, I am not able to pull whether I provide credentials (username and password) to the pull command or not (i.e. just relying on the docker login still being in effect). It doesn't work to pull either way, even though I get a successful login. Here is the error I am getting:
docker_client.images.pull('....us-east.1.amazonaws.com/REPO',tag='TAG')
Traceback (most recent call last):
File "//anaconda3/lib/python3.7/site-packages/docker/api/client.py", line 261, in _raise_for_status
response.raise_for_status()
File "//anaconda3/lib/python3.7/site-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http+docker://localhost/v1.35/images/.....us-east-1.amazonaws.com/REPO:TAG/json
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "//anaconda3/lib/python3.7/site-packages/docker/models/images.py", line 454, in pull
repository, tag, '@' if tag.startswith('sha256:') else ':'
File "//anaconda3/lib/python3.7/site-packages/docker/models/images.py", line 316, in get
return self.prepare_model(self.client.api.inspect_image(name))
File "//anaconda3/lib/python3.7/site-packages/docker/utils/decorators.py", line 19, in wrapped
return f(self, resource_id, *args, **kwargs)
File "//anaconda3/lib/python3.7/site-packages/docker/api/image.py", line 246, in inspect_image
self._get(self._url("/images/{0}/json", image)), True
File "//anaconda3/lib/python3.7/site-packages/docker/api/client.py", line 267, in _result
self._raise_for_status(response)
File "//anaconda3/lib/python3.7/site-packages/docker/api/client.py", line 263, in _raise_for_status
raise create_api_error_from_http_exception(e)
File "//anaconda3/lib/python3.7/site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
raise cls(e, response=response, explanation=explanation)
docker.errors.ImageNotFound: 404 Client Error: Not Found ("no such image: .......us-east-1.amazonaws.com/REPO:TAG: No such image: ..........us-east-1.amazonaws.com/REPO:TAG")
One thing I noticed: why is it trying to fetch the image using a localhost url? It also is taking a very long time to timeout, about 15 minutes or so.
I'm getting this on a Mac and I am using version 4.2.0 of docker-py. Is this a bug or am I doing something wrong? Note that if I just manually try to pull the image, i.e. first doing 'docker login' then 'docker pull' it works fine.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at docker_client.images.pull and compare its client.api image lookup, including the inspect_image request shown in the traceback, with the working docker login and docker pull commands on macOS. Reproduce against the stated ECR repository using docker-py 4.2.0; done means the authenticated pull succeeds without the localhost 404 or the roughly 15-minute delay.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100