Buildx --push overwrites any previous architectures


I am trying to batch my buildx calls into separate CLI invocations, in order to play nice with limited RAM. However, each time I invoke docker buildx build --push…, only the last command’s architectures show up in Docker Hub. All the previous 8 architectures are erased :frowning:

As a workaround, I am performing my --push’es as a distinct docker buildx build --platforms… after my buildx cache is tested and ready. For better or worse, buildx’s caching behavior does not apply the same overwrite logic that buildx’s pushing does.

Unfortunately, that triggers some really spurious warnings about lack of --load / --push… Well, neither of those options are particularly suited to the intuitive, batched, as-many-platforms-as-possible workflow.

Spurious warning:

WARNING: No output specified for docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load

This warning isn’t always actionable. -q fails to silence it. It’s thrown together with critical build information in a catch-all stderr stream. A bit distracting.

Setting environment variable BUILDX_NO_DEFAULT_LOAD to “true” appears to finally quash this warning. Although it’s completely missing from the official buildx documentation.

Back to --push overwrites. Projects stand to benefit from a non-architecture erasing --push behavior. For example, when one FROM base image offers one set of architectures, and another base image offers another mutually set of architectures. The developer can support the union of these architectures, by pushing half of them derived from one base image, and the other half derived from another base image. But that option is not available as long as --push continues to erase any previously uploaded architectures. As a workaround, the developer would have to use different image names / tags. Which breaks the uniformity of the images that buildx was meant to provide.