8
5

More than 1 year has passed since last update.

jboss/keycloak コンテナを M1 mac(arm64) で起動する

Last updated at Posted at 2022-03-18

はじめに

2022年3月18日現在、jboss/keycloak イメージはarm64に未対応となっており、arm64アーキテクチャのCPUの環境ではそのままpullしてきただけでは起動することができません。備忘のために起動するまでの手順を残します。
※公式でarm64対応された場合は本記事に追記しようと思います。

手順

公式のリポジトリをcloneしてlocalでimageをビルドする方法で解決できます。
keycloakは公式がビルドの口となるDockerFileが用意されているのでこちらを利用します。

ビルド手順
# 1. keycloak-containerリポジトリをclone
$ git clone https://github.com/keycloak/keycloak-containers.git

# 2. ディレクトリ移動
$ cd keycloak-containers/server

# 3. 任意のimage名・タグでdocker buildする
$ docker build ./ -t jboss/keycloak:15.0.2
[+] Building 58.1s (9/9) FINISHED                                                                                                                                                                                      
 => [internal] load build definition from Dockerfile                                                                                                                                                              0.0s
 => => transferring dockerfile: 870B                                                                                                                                                                              0.0s
 => [internal] load .dockerignore                                                                                                                                                                                 0.0s
 => => transferring context: 2B                                                                                                                                                                                   0.0s
 => [internal] load metadata for registry.access.redhat.com/ubi8-minimal:latest                                                                                                                                   1.0s
 => CACHED [1/4] FROM registry.access.redhat.com/ubi8-minimal@sha256:574f201d7ed185a9932c91cef5d397f5298dff9df08bc2ebb266c6d1e6284cd1                                                                             0.0s
 => [internal] load build context                                                                                                                                                                                 0.0s
 => => transferring context: 48.02kB                                                                                                                                                                              0.0s
 => [2/4] RUN microdnf update -y && microdnf install -y glibc-langpack-en gzip hostname java-11-openjdk-headless openssl tar which && microdnf clean all                                                         20.1s
 => [3/4] ADD tools /opt/jboss/tools                                                                                                                                                                              0.0s 
 => [4/4] RUN /opt/jboss/tools/build-keycloak.sh                                                                                                                                                                 36.1s 
 => exporting to image                                                                                                                                                                                            0.8s 
 => => exporting layers                                                                                                                                                                                           0.8s 
 => => writing image sha256:18e07fe1af839e99e829c80c0a0f64808dde6f72353550482ac88066222ebd53                                                                                                                      0.0s 
 => => naming to docker.io/jboss/keycloak:15.0.2                                                                                                                                                                  0.0s 
                                                                                                                                                                                                                       
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them  

うまくビルドできると以下のようにimageが出来上がっているため、あとはこれを使ってコンテナを起動するだけ!
スクリーンショット 2022-03-18 10.16.12.png

参考

8
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
5