Skip to content

Instantly share code, notes, and snippets.

@brettferdosi
Last active July 21, 2023 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brettferdosi/9d01a974bae5e6ecb4fcf848923435d3 to your computer and use it in GitHub Desktop.
Save brettferdosi/9d01a974bae5e6ecb4fcf848923435d3 to your computer and use it in GitHub Desktop.
docker cross compilation and running
requires recent-ish docker
to build, first install emulation support binaries for the platforms you want to support (alternatively, if you are on an arm64 mac, you can turn on rosetta emulation in the features under development pane of docker desktop)
```
docker run --privileged --rm tonistiigi/binfmt --install all # can also pass e.g. arm64,amd64 instead of all
```
then build with a platform
```
docker build --platform linux/amd64 <dir>
```
and run with a platform
```
docker run --platform linux/amd64 <img>
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment