title: docker manifest create annotate and push in a script
body: <p>I have DockerHub build images for <code>x86_64</code> for my projects.  The images have this naming: <code>myname/project:version_architecture</code>; such as <code>foo/bar:1.0.0_x86_64</code>.</p>
  <p>Then I build <code>aarch64</code> images on a RPi4: <code>foo/bar:1.0.0_aarch64</code>, which I then push to DockerHub.</p>
  <p>Now I want a manifest that contains both of them so that I can use <code>foo/bar:1.0.0</code> anywhere and it will work.</p>
  <p>AFAIK, The following commands should work (to be run on the RPi):</p>
  <pre><code>docker build -t foo/bar:1.0.0_aarch64 .
  docker push foo/bar:1.0.0_aarch64
  
  docker manifest create foo/bar:1.0.0 foo/bar:1.0.0_aarch64
  docker manifest annotate foo/bar:1.0.0 foo/bar:1.0.0_x86_64
  docker manifest push foo/bar:1.0.0
  </code></pre>
  <p>But for some reason, the <code>annotate</code> step sometimes fails:</p>
  <pre><code>manifest for image foo/bar:1.0.0_x86_64 does not exist in foo/bar:1.0.0
  </code></pre>
  <p>And the following workaround (usually) works instead:</p>
  <pre><code>docker build -t foo/bar:1.0.0_aarch64 .
  docker push foo/bar:1.0.0_aarch64
  
  docker manifest create foo/bar:1.0.0 foo/bar:1.0.0_aarch64
  docker manifest annotate foo/bar:1.0.0 foo/bar:1.0.0_x86_64
  docker manifest create foo/bar:1.0.0 foo/bar:1.0.0_x86_64 --amend
  docker manifest annotate foo/bar:1.0.0 foo/bar:1.0.0_aarch64
  docker manifest push foo/bar:1.0.0
  </code></pre>
  <p>Am I missing something?</p>