-2

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!

David Bernat
  • 324
  • 2
  • 11
  • 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: https://stackoverflow.com/q/35154219/596285 – BMitch Dec 04 '22 at 00:57

1 Answers1

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.

BMitch
  • 231,797
  • 42
  • 475
  • 450
  • 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. – David Bernat Dec 04 '22 at 00:22
  • @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. – BMitch Dec 04 '22 at 00:54
  • @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. – BMitch Dec 04 '22 at 01:01
  • 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. https://stackoverflow.com/questions/74669130/macos-ventura-buildx-not-solving-exec-bin-sh-exec-format-error-problems – David Bernat Dec 04 '22 at 22:39