gpt4 book ai didi

docker - Keycloak 8 : User with username 'admin' already added

转载 作者:行者123 更新时间:2023-12-04 21:28:27 24 4
gpt4 key购买 nike

我无法使用ansible和docker-compose启动keycloak容器。我收到错误消息:用户名“admin”的用户已添加到“/opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json”

我有3个忙碌的工作:

创建网络:

- name: Create a internal network
docker_network:
name: internal

设置postgres:
- name: "Install Postgres"
docker_compose:
project_name: posgressdb
restarted: true
pull: yes
definition:
version: '2'
services:
postgres:
image: postgres:12.1
container_name: postgres
restart: always
env_file:
- /etc/app/db.env
networks:
- internal
volumes:
- postgres-data:/var/lib/postgresql/data
- /etc/app/createdb.sh:/docker-entrypoint-initdb.d/init-app-db.sh
ports:
- "5432:5432"
volumes:
postgres-data:
networks:
internal:
external:
name: internal

创建 key 斗篷容器:
- name: Install keycloak
docker_compose:
project_name: appauth
restarted: true
pull: yes
definition:
version: '2'
services:
keycloak:
image: jboss/keycloak:8.0.1
container_name: keycloak
restart: always
environment:
- DB_VENDOR=POSTGRES
- DB_ADDR=postgres
- DB_PORT=5432
- DB_SCHEMA=public
- DB_DATABASE=keycloak
- DB_USER=keycloak
- DB_PASSWORD=keycloak
- KEYCLOAK_USER=admin
- KEYCLOAK_PASSWORD=admin
networks:
- internal
networks:
internal:
external:
name: internal


有谁知道为什么我会收到此错误?

编辑

如果我将 key 斗篷降级到版本7,它将正常启动!

最佳答案

只是为了阐明其他答案。我遇到过同样的问题。对我有帮助的是:

  • 停止所有容器
  • 注释掉两个相关的行

    version: "3"

    services:
    keycloak:
    image: quay.io/keycloak/keycloak:latest
    environment:
    # KEYCLOAK_USER: admin
    # KEYCLOAK_PASSWORD: pass
    ...
  • 启动所有容器;
  • 等待,直到keycloak容器已成功启动
  • 停止所有容器,再次
  • 从上面的两行中评论回去

    version: "3"

    services:
    keycloak:
    image: quay.io/keycloak/keycloak:latest
    environment:
    KEYCLOAK_USER: admin
    KEYCLOAK_PASSWORD: pass
    ...
  • 启动所有容器

  • 这次(及以后的几次)它起作用了。 Keycloak正在运行,并且管理员用户已注册并按预期工作。

    关于docker - Keycloak 8 : User with username 'admin' already added,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59599620/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com