重新启动容器后,Keycloak Docker容器无法启动

编程入门 行业动态 更新时间:2024-10-28 18:34:16
本文介绍了重新启动容器后,Keycloak Docker容器无法启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个Keycloak安装程序在docker-compose环境中作为docker容器运行.每天晚上,我的备份都会停止相关的容器,执行数据库和卷备份,然后再次重新启动容器.在大多数情况下,它都有效,但是Keycloak似乎有问题,此后不再出现.查看日志,错误消息是:

I have a Keycloak installation running as docker container in a docker-compose environment. Every night, my backup stops relevant containers, performs a DB and volume backup and restarts the containers again. For most it works, but Keycloak seems to have a problem with it and does not come up again afterwards. Looking at the logs, the error message is:

The batch failed with the following error: : keycloak | WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed: keycloak | Step: step-9 keycloak | Operation: /subsystem=datasources/jdbc-driver=postgresql:add(driver-name=postgresql, driver-module-name=org.postgresql.jdbc, driver-xa-datasource-class-name=org.postgresql.xa.PGXADataSource) keycloak | Failure: WFLYCTL0212: Duplicate resource [ keycloak | ("subsystem" => "datasources"), keycloak | ("jdbc-driver" => "postgresql") keycloak | ] ... The batch failed with the following error: : keycloak | WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed: keycloak | Step: step-9 keycloak | Operation: /subsystem=datasources/jdbc-driver=postgresql:add(driver-name=postgresql, driver-module-name=org.postgresql.jdbc, driver-xa-datasource-class-name=org.postgresql.xa.PGXADataSource) keycloak | Failure: WFLYCTL0212: Duplicate resource [ keycloak | ("subsystem" => "datasources"), keycloak | ("jdbc-driver" => "postgresql") keycloak | ]

Keycloak的docker-compose.yml条目如下所示,重要数据已明显删除

The docker-compose.yml entry for Keycloak looks as follows, important data obviously removed

keycloak: image: jboss/keycloak:8.0.1 container_name: keycloak environment: - PROXY_ADDRESS_FORWARDING=true - DB_VENDOR=postgres - DB_ADDR=db - DB_DATABASE=keycloak - DB_USER=keycloak - DB_PASSWORD=<password> - VIRTUAL_HOST=<url> - VIRTUAL_PORT=8080 - LETSENCRYPT_HOST=<url> volumes: - /opt/docker/keycloak-startup:/opt/jboss/startup-scripts

我要映射的卷在那里对WildFly进行了一些更改,以确保它在反向代理中表现良好:

The volume I'm mapping is there to make some changes to WildFly to make sure it behaves well with the reverse proxy:

embed-server --std-out=echo # Enable https listener for the new security realm /subsystem=undertow/ \ server=default-server/ \ http-listener=default \ :write-attribute(name=proxy-address-forwarding, \ value=true) # Create new socket binding with proxy https port /socket-binding-group=standard-sockets/ \ socket-binding=proxy-https \ :add(port=443) # Enable https listener for the new security realm /subsystem=undertow/ \ server=default-server/ \ http-listener=default \ :write-attribute(name=redirect-socket, \ value="proxy-https")

停止容器后,不再显示上述消息以启动容器.但是,删除容器并重新创建它可以正常工作.我尝试在初次启动后删除该卷,但这也没什么大不了.我已经了解到,在初次启动后必须删除KEYCLOAK_USER=admin和KEYCLOAK_PASSWORD环境变量,否则容器会抱怨该用户已经存在并且不再启动.知道如何解决该问题吗?

After stopping the container, its not starting anymore with the messages shown above. Removing the container and re-creating it works fine however. I tried to remove the volume after the initial start, this doesn't really make a difference either. I already learned that I have to remove the KEYCLOAK_USER=admin and KEYCLOAK_PASSWORD environment variables after the initial boot as otherwise the container complains that the user already exists and doesn't start anymore. Any idea how to fix that?

推荐答案

根据RedHat支持,这是已知的问题".并且不应该被修复.他们希望专注于删除和重新创建容器而不是启动和停止容器的工作流程.他们同意普遍存在的问题,但表示目前没有可用资源.停止和启动容器是当前不支持的操作.

According to RedHat support, this is a known "issue" and not supposed to be fixed. They want to concentrate on a workflow where a container is removed and recreated, not started and stopped. They agreed with the general problem, but stated that currently there are no resources available. Stopping and starting the container is a operation which is currently not supported.

例如参见 issues.redhat/browse/KEYCLOAK-13094?jql=project%20%3D%20KEYCLOAK%20AND%20text%20~%20%22docker%20restart%22 供参考

更多推荐

重新启动容器后,Keycloak Docker容器无法启动

本文发布于:2023-10-25 14:38:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1527246.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:容器   重新启动   无法启动   Keycloak   Docker

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!