{"id":114,"date":"2025-03-04T06:51:32","date_gmt":"2025-03-04T06:51:32","guid":{"rendered":"https:\/\/haco.club\/?p=114"},"modified":"2025-11-26T14:33:53","modified_gmt":"2025-11-26T14:33:53","slug":"running-arm64-docker-container-on-x86","status":"publish","type":"post","link":"https:\/\/haco.club\/?p=114","title":{"rendered":"Running arm64 docker container on x86"},"content":{"rendered":"\n<p>Make sure to install the packages mentioned in&nbsp;<a href=\"https:\/\/docs.docker.com\/build\/building\/multi-platform\/#qemu-without-docker-desktop\">Multi-platform builds<\/a>, which then will allows docker to leverage qemu, which then emulates the target cpu architecture.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">binfmt<\/h2>\n\n\n\n<p>Use the&nbsp;<a href=\"https:\/\/github.com\/tonistiigi\/binfmt\"><code>tonistiigi\/binfmt<\/code><\/a>&nbsp;image to install QEMU and register the executable types on the host with a single command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ docker run --privileged --rm tonistiigi\/binfmt --install all<\/code><\/pre>\n\n\n\n<p>This installs the QEMU binaries and registers them with&nbsp;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Binfmt_misc\"><code>binfmt_misc<\/code><\/a>, enabling QEMU to execute non-native file formats for emulation.<\/p>\n\n\n\n<p>Once QEMU is installed and the executable types are registered on the host OS, they work transparently inside containers. You can verify your registration by checking if&nbsp;<code>F<\/code>&nbsp;is among the flags in&nbsp;<code>\/proc\/sys\/fs\/binfmt_misc\/qemu-*<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">docker<\/h2>\n\n\n\n<p>To run ubuntu on aarch64:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker run --platform linux\/arm64 -d -v \/opt\/shared:\/opt\/shared --name arm64v8 arm64v8\/ubuntu tail -f \/dev\/null\ndocker exec -it arm64v8 \/bin\/bash<\/code><\/pre>\n\n\n\n<p>Once the prerequisites are installed you can build and run images for other cpu architectures like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker build --platform linux\/arm64 -t test .\ndocker run --platform linux\/arm64 test<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Make sure to install the packages mentioned in&nbsp;Multi-platform builds, which [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[15],"class_list":["post-114","post","type-post","status-publish","format-standard","hentry","category-tutotial","tag-docker"],"_links":{"self":[{"href":"https:\/\/haco.club\/index.php?rest_route=\/wp\/v2\/posts\/114","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/haco.club\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/haco.club\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/haco.club\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/haco.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=114"}],"version-history":[{"count":3,"href":"https:\/\/haco.club\/index.php?rest_route=\/wp\/v2\/posts\/114\/revisions"}],"predecessor-version":[{"id":282,"href":"https:\/\/haco.club\/index.php?rest_route=\/wp\/v2\/posts\/114\/revisions\/282"}],"wp:attachment":[{"href":"https:\/\/haco.club\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/haco.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/haco.club\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}