-1

Does docker push possess a --force flag which forces all layers to be pushed to the repository, regardless of whether the repository believes those layers are unchanged?

Thank you!

asked Dec 3, 2022 at 17:39
1
  • This appears to be an X-Y problem. Here's a possible duplicate to the best guess of the actual issue from the limited details here: stackoverflow.com/q/35154219/596285 Commented Dec 4, 2022 at 0:57

1 Answer 1

0

No, there's no --force option to docker push. You can see the options by running docker push --help.

The only reason to force push blobs is if the registry is broken or you've encountered a sha256 hash collision within your repository. I've yet to see a hash collision in app my time using docker. And if the registry is broken, you can delete the affected images from the server and push them again, but I'd put more effort into preventing whatever is corrupting your registry.

If this is an X-Y problem, and you're just not seeing your changes, use unique tags to ensure your image is being pulled. If your builds are being cached, try building with --no-cache. And realize the container images are based on a content addressable store, so you won't have different content represented by the same digest.

answered Dec 3, 2022 at 23:06
Sign up to request clarification or add additional context in comments.

4 Comments

This is an unusual answer. I appreciate your domain expertise. You clearly know your stuff. I am encountering a problem for which fresh compiles are not updating; and that is the purpose of the question regarding an undocumented --force flag. Your suggestion about changing the tag is correct; however, amounts to changing the name for the purpose of working around a potential bug that is unable to be probed by the provided tools. Useful, but not the problem at hand. :-) I have another post to debug this specifically, and will link it here. Thank you. 🙏
@DavidBernat This is an X-Y problem. If you are running two builds and getting the same image, then none of the inputs changed and the cache was used. The issue is not with the push itself.
@DavidBernat the suggestion to change the tag is because many users will used cached images rather than pulling the latest image with changes pushed upstream. A unique tag ensures that is not the case. If changing the tag helps, the issue is not with the push but with the pull, and we don't have details here about what you're doing to debug that.
Thank you for your clarification @BMitch, sharing your insight. The reason this post is posed as a 'feature question' (or a feature request) is to identify a specific tool for any docker debugging process. The discussion of the specific problem that led to me discover that this tool would be helpful is actual its own post. Turns out, incidentally, under the hood buildx assumptions are made during docker push, but that is out of scope of this conversation in this thread. stackoverflow.com/questions/74669130/…

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.