Keycloak do not provide Docker images for arm64
platforms, only linux/amd64
versions are available on Docker Hub, see jboss/keycloak for these. I am
running a Raspberry Pi 64bit cluster and need a linux/arm64
image.
The sleighzy/keycloak images on Docker Hub have been built using the
instructions below and provide the linux/arm64
support.
Clone the official GitHub repo keycloak/keycloak-containers to obtain the assets needed to build the container.
git clone https://github.com/keycloak/keycloak-containers.git
cd keycloak-containers/server
The Keycloak version in the master
branch does not always match the most
recent version of the official Keycloak image in Docker Hub. For example,
15.0.0
vs 15.0.2
. Switch to the latest
branch as the Dockerfile
in that
branch should match the version and Dockerfile in Docker Hub.
git branch latest
The Docker commands below have been run on the Raspberry Pi itself as Docker will build the image for the platform that it is being run on, i.e. arm64 in this case. You can also use the new Docker Buildx that provides the means to build images for multiple architectures, see the Leverage multi-CPU architecture support Docker docs for more info. This was one approach I took initially when building this on my Mac laptop, I'll add some notes about this later.
docker build -t sleighzy/keycloak:15.0.2-arm64 .
Run the container to ensure that it starts up as expected and that it runs to completion and is accessible.
docker run \
--rm \
-p 8080:8080 \
-e KEYCLOAK_USER=admin \
-e KEYCLOAK_PASSWORD=password \
sleighzy/keycloak:15.0.2-arm64
Tag the image as latest and push both tags to Docker Hub. Profit.
docker tag sleighzy/keycloak:15.0.2-arm64 sleighzy/keycloak:latest
docker push sleighzy/keycloak:15.0.2-arm64
docker push sleighzy/keycloak:latest
There is also another option for building images as well. My Raspberry Pi
cluster is running the K3s Kubernetes distribution which runs on containerd,
hence Docker does not need to be installed on the Raspberry Pi. See my Building
images with BuildKit for containerd notes for more information on this and
using buildctl
to build these.