Use .NET Core and Docker on ARM32 and Raspberry Pi
Note: that Docker refers to ARM32 as
armhfin documentation and other places.
See Use ASP.NET Core on Linux ARM32 with Docker for ASP.NET Core apps.
Note: .NET Core can be be used with devices that use ARMv7 and ARMv8 chips, for example Raspberry Pi2 and Raspberry Pi3, respectively. .NET Core does not support ARMv6 / ARM11 devices, for example Raspberry Pi Zero.
Try a pre-built .NET Core Docker Image
Type the following Docker command:
docker run --rm mcr.microsoft.com/dotnet/core/samples
Building .NET Core Samples with Docker
You can build the same .NET Core console samples and ASP.NET Core sample on ARM devices as you can on other architectures. For example, the following instructions will work on an ARM32 device. The instructions assume that you are in the root of this repository.
cd samples cd dotnetapp docker build --pull -t dotnetapp . docker run --rm dotnetapp
Another option is to build ARM32 Docker images on an X64 machine. You can do by using the same pattern used in the Dockerfile.debian-arm32-selfcontained dockerfile (demonstrated in a following section). It uses a multi-arch tag for building with the SDK and then an ARM32-specific tag for creating a runtime image. The pattern of building for other architectures only works because the Dockerfile doesn't run code in the runtime image.
Building Self-contained Applications for ARM32
You can Build .NET Core Self-Contained Applications with Docker for an ARM32 deployment using this Dockerfile.
The instructions assume that you are in the root of this repository.
cd samples cd dotnetapp docker build --pull -t dotnetapp -f Dockerfile.debian-arm32-selfcontained . docker run --rm dotnetapp
Pushing the image to a Container Registry
Push the image to a container registry after building the image so that you can pull it from another ARM32 device. You can also build an ARM32 image on an X64 machine, push to a registry and then pull from an ARM32 device. Instructions are provided for pushing to both Azure Container Registry and DockerHub (you only need to choose one):