Pushing a non existent tag doesn't raise an exception
See original GitHub issueI get this error in the error output but no exception is raised:
{"status":"The push refers to repository [485757098324.dkr.ecr.us-east-1.amazonaws.com/ssh_proxy]"}
{"errorDetail":{"message":"An image does not exist locally with the tag: 485757098324.dkr.ecr.us-east-1.amazonaws.com/ssh_proxy"},"error":"An image does not exist locally with the tag: 485757098324.dkr.ecr.us-east-1.amazonaws.com/ssh_proxy"}
Unlike related issue #1772 there’s really no excuse here, since this error can be detected even if trying to push to a black box, while #1772 requires understanding the output of a repo server.
Also worth mentioning that the docker push
command WILL return an error code in this case. So actually the docker push command gives MORE info than the SDK function. Since the docker push command gives output + error code. While the SDK function only gives output 😦
(Not saying the function needs to BC break and return two values, just that it needs to raise exceptions when appropriate)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:9 (3 by maintainers)
Top Results From Across the Web
How do you fix a docker push error, tag does not exist?
I misspelled the tag, so when I tried to push with the correct tag name, it couldn't find it (because it didn't exist...
Read more >Google Tag Manager Errors - Tag Assistant Help
The Data Layer variable name is case-sensitive. If you try to push a variable or event without the proper casing, the push will...
Read more >A Definitive Guide to Handling Errors in JavaScript - Kinsta
This error occurs when you try to invoke a method that doesn't exist in your script, or it does but can not be...
Read more >Python KeyError Exceptions and How to Handle Them
In this tutorial, you'll learn how to handle Python KeyError exceptions. They are often caused by a bad key lookup in a dictionary,...
Read more >Exception and Error Handling in Python - DataCamp
Raise exceptions in Python and catch your errors today! ... ImportError is raised when you try to import a module that does not...
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
@chris-crone https://github.com/moby/moby/pull/38467 likely won’t help in this case, because the daemon sent a 200 status before it detects the error; https://github.com/moby/moby/pull/38467 will make the client return the status code (instead of just a plain error).
I can try if waiting to send the “The push refers to repository” message until after the initial error detection was done could allow us to send a proper status code (and prevent the 200 status from being sent before that).
FWIW, I do think we still need the python sdk to detect errors if an
errorDetail
arrives; even though this initial error check could make it possible to send a 4xx status code, there may be situations where an error occurs further down the push (e.g. push is in progress, but the registry returns a failure). Due to this endpoint returning a stream, the status code cannot be updated at that point.Also see the above; in this case it looks like the validation is actually done before the actual push happens (but the initial message was already sent; I’ll try and see if that particular case can be resolved)
@caeus There is no update on this behavior in
docker-py
. Currently, the library exposes the Engine API as-is here. The engine will return a200
if the push is able to start, and then streams push status back in the response. If an error is hit during push, that will be reflected in the events. Thepush_wrapper
example from this comment shows how to handle this API response.