How to edit files inside Keycloak running on a docker container

Hi folks,

How can I edit the files inside Keycloak running on a docker container. for example I would like to edit standalone.xml. But I tried to install vi and nano. but it didn’t work. I think Keycloak uses a different distribution and I don’t know how to install a editor on this distribution. Can someone help me?

mount the file you want to edit outside the container.
Look at the docker-compose.yml file in https://github.com/zonaut/keycloak-extensions

1 Like

Thanks for your answer.

You can configure a lot of things from environment variables passed to docker and not have to edit standalone.xml at all. See https://hub.docker.com/r/jboss/keycloak

You can’t just login to the container and start editing files as they will be lost when the container is recreated.

I second the suggestion to mount the files you want to edit. Usually these are in /opt/jboss/keycloak/.

One alternative we found useful if you want to deploy a Keycloak container with modified files is to create a Dockerfile from the Keycloak image and then run sed scripts to change the configs in the new image.