docker-compose에서 레거시 태그 대신 keycloak 최신 태그를 사용하는 방법

7403 단어 keycloakdocker
안녕하세요 여러분.

얼마전, 그리고 오랜만에 새로운 키클록 버전을 다시 써보려고 했습니다.
그러나이 작성으로 컨테이너를 시작하는 데 몇 가지 문제가 있습니다.

version: '3.8'
volumes:
  postgres_data:
    driver: local
  keycloak_data:
    driver: local
networks:
  local:
    name: localhost
    external: true
services:
  postgres:
    image: 'postgres:latest'
    networks:
      - local
    volumes:
      - 'postgres_data:/var/lib/postgresql/data'
    environment:
      POSTGRES_DB: keycloak
      POSTGRES_USER: keycloak
      POSTGRES_PASSWORD: password
  keycloak:
    image: 'quay.io/keycloak/keycloak:latest'
    networks:
      - local
    environment:
      DB_VENDOR: POSTGRES
      DB_ADDR: postgres
      DB_DATABASE: keycloak
      DB_USER: keycloak
      DB_SCHEMA: public
      DB_PASSWORD: password
      KEYCLOAK_USER: admin
      KEYCLOAK_PASSWORD: admin123
    ports:
      - '8000:8080'
    depends_on:
      - postgres
  pgadmin4:
    image: 'dpage/pgadmin4:latest'
    environment:
      PGADMIN_DEFAULT_EMAIL: [email protected]
      PGADMIN_DEFAULT_PASSWORD: admin123
    networks:
      - local
    depends_on:
      - postgres
    ports:
      - '6543:80'


이 Compose가 작동하는지 확인하고 싶었지만 docker-compose를 실행했을 때 다음 오류가 발생했습니다.

Attaching to keycloak-latest_keycloak_1
keycloak_1  | Keycloak - Open Source Identity and Access Management
keycloak_1  | 
keycloak_1  | Find more information at: https://www.keycloak.org/docs/latest
keycloak_1  | 
keycloak_1  | Usage:
keycloak_1  | 
keycloak_1  | kc.sh [OPTIONS] [COMMAND]
keycloak_1  | 
keycloak_1  | Use this command-line tool to manage your Keycloak cluster.
keycloak_1  | Make sure the command is available on your "PATH" or prefix it with "./" (e.g.:
keycloak_1  | "./kc.sh") to execute from the current folder.
keycloak_1  | 
keycloak_1  | Options:
keycloak_1  | 
keycloak_1  | -cf, --config-file 
keycloak_1  |                      Set the path to a configuration file. By default, configuration properties are
keycloak_1  |                        read from the "keycloak.conf" file in the "conf" directory.
keycloak_1  | -h, --help           This help message.
keycloak_1  | -v, --verbose        Print out error details when running this command.
keycloak_1  | -V, --version        Show version information
keycloak_1  | 
keycloak_1  | Commands:
keycloak_1  | 
keycloak_1  |   build                   Creates a new and optimized server image.
keycloak_1  |   start                   Start the server.
keycloak_1  |   start-dev               Start the server in development mode.
keycloak_1  |   export                  Export data from realms to a file or directory.
keycloak_1  |   import                  Import data from a directory or a file.
keycloak_1  |   show-config             Print out the current configuration.
keycloak_1  |   tools                   Utilities for use and interaction with the server.
keycloak_1  |     completion            Generate bash/zsh completion script for kc.sh.
keycloak_1  | 
keycloak_1  | Examples:
keycloak_1  | 
keycloak_1  |   Start the server in development mode for local development or testing:
keycloak_1  | 
keycloak_1  |       $ kc.sh start-dev
keycloak_1  | 


바꾸다



따라서 작성 시 몇 가지 간단한 구성을 변경하고 추가해야 합니다.

Keycloak의 관리 환경 변수가 각각 KEYCLOAK_USERKEYCLOAK_PASSWORD에서 KEYCLOAK_ADMINKEYCLOAK_ADMIN_PASSWORD로 변경되었습니다.
그리고 작성에 'command: start-dev'를 포함해야 합니다.

변경 후 작성은 다음과 같아야 합니다.

....
  keycloak:
    image: 'quay.io/keycloak/keycloak:latest'
    networks:
      - local
    environment:
      DB_VENDOR: POSTGRES
      DB_ADDR: postgres
      DB_DATABASE: keycloak
      DB_USER: keycloak
      DB_SCHEMA: public
      DB_PASSWORD: password
      KEYCLOAK_ADMIN: admin //Changed
      KEYCLOAK_ADMIN_PASSWORD: admin123 //Changed
    ports:
      - '8000:8080'
    command: start-dev // Added
    depends_on:
      - postgres
....


그런 다음 다시 실행할 수 있으며 콘솔 출력은 다음과 같아야 합니다.:

Attaching to keycloak-latest_keycloak_1keycloak_1  | Updating the configuration and installing your custom providers, if any. Please wait.Attaching to keycloak-latest_keycloak_1
keycloak_1  | 2022-08-02 15:02:59,158 INFO  [io.quarkus.deployment.QuarkusAugmentor] (main) Quarkus augmentation completed in 6757ms
keycloak_1  | 2022-08-02 15:03:02,504 INFO  [org.keycloak.quarkus.runtime.hostname.DefaultHostnameProvider] (main) Hostname settings: FrontEnd: , Strict HTTPS: false, Path: , Strict BackChannel: false, Admin: , Port: -1, Proxied: false
keycloak_1  | 2022-08-02 15:03:03,351 WARN  [org.infinispan.PERSISTENCE] (keycloak-cache-init) ISPN000554: jboss-marshalling is deprecated and planned for removal
keycloak_1  | 2022-08-02 15:03:03,469 WARN  [org.infinispan.CONFIG] (keycloak-cache-init) ISPN000569: Unable to persist Infinispan internal caches as no global state enabled
keycloak_1  | 2022-08-02 15:03:03,514 INFO  [org.infinispan.CONTAINER] (keycloak-cache-init) ISPN000556: Starting user marshaller 'org.infinispan.jboss.marshalling.core.JBossUserMarshaller'
keycloak_1  | 2022-08-02 15:03:03,752 INFO  [org.infinispan.CONTAINER] (keycloak-cache-init) ISPN000128: Infinispan version: Infinispan 'Triskaidekaphobia' 13.0.9.Final
keycloak_1  | 2022-08-02 15:03:04,200 INFO  [org.keycloak.connections.infinispan.DefaultInfinispanConnectionProviderFactory] (main) Node name: node_357415, Site name: null
keycloak_1  | 2022-08-02 15:03:05,672 INFO  [org.keycloak.quarkus.runtime.storage.database.liquibase.QuarkusJpaUpdaterProvider] (main) Initializing database schema. Using changelog META-INF/jpa-changelog-master.xml
keycloak_1  | 2022-08-02 15:03:08,125 INFO  [org.keycloak.services] (main) KC-SERVICES0050: Initializing master realm
keycloak_1  | 2022-08-02 15:03:10,137 INFO  [org.keycloak.services] (main) KC-SERVICES0009: Added user 'admin' to realm 'master'
keycloak_1  | 2022-08-02 15:03:10,279 INFO  [io.quarkus] (main) Keycloak 18.0.2 on JVM (powered by Quarkus 2.7.5.Final) started in 10.932s. Listening on: http://0.0.0.0:8080
keycloak_1  | 2022-08-02 15:03:10,280 INFO  [io.quarkus] (main) Profile dev activated. 
keycloak_1  | 2022-08-02 15:03:10,280 INFO  [io.quarkus] (main) Installed features: [agroal, cdi, hibernate-orm, jdbc-h2, jdbc-mariadb, jdbc-mssql, jdbc-mysql, jdbc-oracle, jdbc-postgresql, keycloak, narayana-jta, reactive-routes, resteasy, resteasy-jackson, smallrye-context-propagation, smallrye-health, smallrye-metrics, vault, vertx]
keycloak_1  | 2022-08-02 15:03:10,287 WARN  [org.keycloak.quarkus.runtime.KeycloakMain] (main) Running the server in development mode. DO NOT use this configuration in production.


웹 브라우저를 사용하여 다음 페이지를 볼 수 있습니다.



결론



그게 다야.

그것은 내가 최근에 발견한 것입니다.

이 게시물을 개선할 수 있는 방법에 대한 제안 사항이 있으면 알려주십시오. 제안이나 비판이 있으면 의견을 남겨주세요.

또 봐요!

좋은 웹페이지 즐겨찾기