Simple JWT authentication example with Docker

I want to find a simple example of JWT based authentication for Elasticsearch with docker.

I am using the the docker-compose.yml file provided by Elastic here at:

Is there a resource where I can set that up with the minimal settings required, I can use ruby based JWT to create the tokens.

Hello, thanks for reaching out,
I updated the tags since the Elastic Security references the "Elastic Security Solution" questions, this is an Elasticsearch question. I'll forward it to the correct team.


First of all JWT authn is not available in version 7.17.
I recommend you go with version 8.12.
Secondly, docker/docker compose configuration is only tangential to (JWT) authn realm configuration (i.e. if you get to a JWT configuration that works for a single node cluster, launched under the env your most familar with, it should efortlessly translate to the docker compose setup).

Here are the docs explaining JWT configuration: JWT authentication | Elasticsearch Guide [8.12] | Elastic
JWT realm configuration is very versatile. You can also take inspiration from integration tests we use on our CI: elasticsearch/x-pack/qa/oidc-op-tests/src/javaRestTest/java/org/elasticsearch/xpack/security/authc/oidc/ at fca3fc82beda930e75d147331dce4dbfdc546e61 · elastic/elasticsearch · GitHub