gpt4 book ai didi

Docker-compose 卷不保存 Keycloak 的容器状态

转载 作者:行者123 更新时间:2023-12-05 02:09:59 25 4
gpt4 key购买 nike

docker-compose.yml

services:
idprovider-app:
container_name: idprovider-app
build:
dockerfile: Dockerfile
context: .
environment:
KEYCLOAK_USER: admin
KEYCLOAK_PASSWORD: admin
volumes:
- keycloak-data-volume:/var/lib/keycloak/data
ports:
- "8090:8090"
- "8443:8443"
volumes:
keycloak-data-volume:
external: true

docker 文件

FROM jboss/keycloak:7.0.1
EXPOSE 8080
EXPOSE 8443

docker 检查“容器”

"Mounts": [
{
"Type": "volume",
"Name": "keycloak-data-volume",
"Source": "/mnt/sda1/var/lib/docker/volumes/keycloak-data-volume/_data",
"Destination": "/var/lib/keycloak/data",
"Driver": "local",
"Mode": "rw",
"RW": true,
"Propagation": ""
}
],

docker volume inspect keycloak-data-volume

[
{
"CreatedAt": "2019-12-10T19:31:55Z",
"Driver": "local",
"Labels": {},
"Mountpoint": "/mnt/sda1/var/lib/docker/volumes/keycloak-data-volume/_data",
"Name": "keycloak-data-volume",
"Options": {},
"Scope": "local"
}
]

没有错误,但不保存状态。我不知道出了什么问题。我在 Windows 10 上运行它。

最佳答案

使用默认数据库位置,您可以尝试使用 docker-compose 这个选项:

keycloak:
image: quay.io/keycloak/keycloak:14.0.0
container_name: keycloak
environment:
KEYCLOAK_USER: admin
KEYCLOAK_PASSWORD: admin
ports:
- "8082:8080"
restart: always
volumes:
- .local/keycloak/:/opt/jboss/keycloak/standalone/data/

找到与普通 docker 相似的答案 https://stackoverflow.com/a/60554189/6916890

docker run --volume/root/keycloak/data/:/opt/jboss/keycloak/standalone/data/

关于Docker-compose 卷不保存 Keycloak 的容器状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59278955/

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