Last active
July 21, 2023 19:54
-
-
Save brettferdosi/9d01a974bae5e6ecb4fcf848923435d3 to your computer and use it in GitHub Desktop.
docker cross compilation and running
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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