<p>This is answered in the <a href="https://www.docker.com/blog/multi-platform-docker-builds/" rel="nofollow noreferrer">Docker blog post on multi-platform docker builds</a>. For your specific situation, you would perform a build and push for each platform you'd like, then create a manifest file and push that. Then you can perform the save. It would look something like this:</p>
<pre class="lang-bash prettyprint-override"><code>$ docker buildx build --platform linux/amd64 --push -t localhost:5000/myimage:amd64 .
$ docker buildx build --platform linux/arm64 --push -t localhost:5000/myimage:arm64 .
$ docker manifest create myimage:latest myimage:amd64 myimage:arm64
$ docker manifest push localhost:5000/myimage:latest
$ docker image save -o myimage.tar localhost:5000/myimage:latest
</code></pre>

CC BY-SA 4.0
2022-09-23T20:31:50.947Z
It seems to me that — if this is the solution — then there is no way to use the old workflow of `pull | save` to preserve a manifest on the client and push it to another registry. This SO answer suggests registry-to-registry push instead: https://stackoverflow.com/a/68576882/2496266
Chaim Eliyah
CC BY-SA 4.0
2023-12-04T19:17:52.190Z
This answer doesn't do what was requested. The `docker image save` command creates an archive, but if you open the archive and look at the contents you'll find that it actually only includes the one image matching the current system architecture (probably linux/amd64).
mtalexan
CC BY-SA 4.0
2022-09-01T05:18:02.150Z
2022-09-01T05:18:02.150Z
T145
<p>I have a multi-arch build that is pushing to a local registry I have running:</p>
<pre><code>docker buildx build --platform linux/amd64,linux/arm64 --push -t localhost:5000/myimage:latest
</code></pre>
<p>I need to export this multi-arch image to a <code>.tar</code> file for future use with <code>docker load</code>. I cannot for the life of me find a way to do this.</p>
<p>I've tried:</p>
<pre><code>docker pull localhost:5000/myimage:latest
docker save -o myimage.tar localhost:5000/myimage:latest
</code></pre>
<p>And this exports only the image for my architecture (<code>amd64</code>). So then I tried:</p>
<pre><code>docker pull --platform linux/arm64 --platform linux/amd64 localhost:5000/myimage:latest
docker save -o myimage.tar localhost:5000/myimage:latest
</code></pre>
<p>And this has the same result, even though I'm explicitly telling it to pull both architectures.</p>
<p>How can I export a multi-arch image from a local registry as a single <code>.tar</code> file?</p>

<docker><docker-registry>
Exporting multi-arch Docker image from local registry to .tar file
Jordan
# Exporting multi-arch Docker image from local registry to .tar file

(Asked by: username_0 on 2022-08-29)

I have a multi-arch build that is pushing to a local registry I have running:
docker buildx build --platform linux/amd64,linux/arm64 --push -t localhost:5000/myimage:latest

I need to export this multi-arch image to a .tar file for future use with docker load. I cannot for the life of me find a way to do this.
I've tried:
docker pull localhost:5000/myimage:latest
docker save -o myimage.tar localhost:5000/myimage:latest

And this exports only the image for my architecture (amd64). So then I tried:
docker pull --platform linux/arm64 --platform linux/amd64 localhost:5000/myimage:latest
docker save -o myimage.tar localhost:5000/myimage:latest

And this has the same result, even though I'm explicitly telling it to pull both architectures.
How can I export a multi-arch image from a local registry as a single .tar file?

**Tags:** docker, docker-registry


---

## 1 answers

### Answer by username_1 on 2022-09-01. Score: 2

This is answered in the Docker blog post on multi-platform docker builds. For your specific situation, you would perform a build and push for each platform you'd like, then create a manifest file and push that. Then you can perform the save. It would look something like this:
$ docker buildx build --platform linux/amd64 --push -t localhost:5000/myimage:amd64 .
$ docker buildx build --platform linux/arm64 --push -t localhost:5000/myimage:arm64 .
$ docker manifest create myimage:latest myimage:amd64 myimage:arm64
$ docker manifest push localhost:5000/myimage:latest
$ docker image save -o myimage.tar localhost:5000/myimage:latest

> **Comments:**
> **username_2**: It seems to me that — if this is the solution — then there is no way to use the old workflow of `pull | save` to preserve a manifest on the client and push it to another registry. This SO answer suggests registry-to-registry push instead: https://stackoverflow.com/a/68576882/2496266  
> **username_3**: This answer doesn't do what was requested. The `docker image save` command creates an archive, but if you open the archive and look at the contents you'll find that it actually only includes the one image matching the current system architecture (probably linux/amd64).  

---

