how to use a docker secret for keycloak applications using a docker swarm2 min read
Hi All, this document shows you how to use a docker secret for keycloak applications using a docker swarm.
Docker secret enables you to hide sensitive data such as usernames and passwords from the docker environment variables.
Docker secret works only in swarm mode.
Docker swarm converts the secrets variable to environmental variables internally for the containers.
/run/secrets is the default storage location of docker secrets and these secrets are unencrypted inside the container(/run/secrets/<secret_name>).
1. create a docker secret for DB user password and keycloak admin user.
2. Now we have secrets created for DB password and keycloak admin user.
Create the docker-compose file to use docker secret
NOTE: This is specifically for keycloak. For others stay tuned !!
that’s it, now you see the keycloak docker service is using docker secret which we created before.
You can check the secret file in /run/secret/<secret-name> inside the docker.