Cross building ARM images on Docker Desktop
Just recently on Dockercon 2019, Docker announced a great feature from their ARM partnership. Now it's possible to cross-build Docker images for multiple architectures using Docker Desktop.
Docker desktop is currently the best option for developers to build, test and run their applications with portability. This new feature brings the possibility of building container images for ARM and ARM64 architectures in a transparent way with lots of possibilities like running on Amazon A1 instances that can be up to 45% cheaper than Intel, running on Raspberry Pi's or even more powerful ARM SBCs like I used before.
In this article, I will demonstrate using a simple Go application, a Hello World web server, how to leverage Docker desktop with multi-stage Dockerfiles to build your application dynamically inside a container and then generating the multi-arch images for it.
Pre-requisites
To use the features demonstrated here, you need the edge version of Docker (19.03-beta3) / Docker desktop 2.0.4.0 available here.
Creating the application
package mainimport (
"fmt"
"log"
"net/http"
)func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hi there %s, I'm a Go…