How to set up default 'elastic' user password while running official Elasticsearch docker image? How to set up default 'elastic' user password while running official Elasticsearch docker image? elasticsearch elasticsearch

How to set up default 'elastic' user password while running official Elasticsearch docker image?


The solution that worked for me was to put nginx proxy container with basic authentication in front of elasticsearch container. Nginx config may look something like:

upstream elasticsearch {    server elasticsearch:9200;}server {    listen 80;    server_name server.name.com;    auth_basic "Restricted";    auth_basic_user_file /etc/nginx/conf.d/.htpasswd;    location / {        proxy_pass http://elasticsearch;        proxy_redirect off;        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;        proxy_set_header X-Real-IP $remote_addr;        proxy_set_header Host $host;    }}

Where .htpasswd contains user name and encrypted user password (you may use even online services to generate it like http://www.htaccesstools.com/htpasswd-generator/).

Other than that you may just buy a licence for X-pack/Shield and use it instead if you wish.