Installing OpenSearch with Docker on Debian

Post Reply
User avatar
isscbta
Team Member
Posts: 160
Joined: Mon Jul 19, 2021 1:41 am
Has thanked: 19 times
Been thanked: 3 times

Here is a quick guide to install OpenSearch with Docker Compose:

If you need to install docker first, check - viewtopic.php?f=35&t=772

First, decide which version you want to install, 2.x or 3.x.


For OpenSearch 2.x version do the following:

Code: Select all

# download the official docker-compose file
wget https://raw.githubusercontent.com/opensearch-project/opensearch-build/refs/heads/main/docker/release/dockercomposefiles/docker-compose-2.x.yml

mv docker-compose-2.x.yml docker-compose.yml
For OpenSearch 3.x version do the following:

Code: Select all

# download the official docker-compose file
wget https://raw.githubusercontent.com/opensearch-project/opensearch-build/refs/heads/main/docker/release/dockercomposefiles/docker-compose-3.x.yml

mv docker-compose-3.x.yml docker-compose.yml
Next - edit the file:

Code: Select all

mcedit docker-compose.yml
To avoid conflicts with ElasticSearch default ports, change the following block:

Code: Select all

ports:

9200:9200

9600:9600 # required for Performance Analyzer
into:

Code: Select all

ports:

127.0.0.1:9202:9200

127.0.0.1:9602:9600 # required for Performance Analyzer
Now set an initial admin password (use your own random one):

Code: Select all

export OPENSEARCH_INITIAL_ADMIN_PASSWORD='some_password'
Run it:

Code: Select all

docker-compose up
(Press CTRL+C if everything looks OK.)

Then start it again in the background:

Code: Select all

docker-compose up -d
SSL

Additionaly, if you need SSL, for desired domain, use this .stpl:

Code: Select all


server {
    listen      %ip%:%proxy_ssl_port% ssl;
    http2 on;
    server_name %domain_idn% %alias_idn%;

    ssl_certificate      %ssl_pem%;
    ssl_certificate_key  %ssl_key%;
    error_log  /var/log/%web_system%/domains/%domain%.error.log error;

    location / {
            proxy_pass http://localhost:9202/;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
        }

    location /error/ {
        alias   %home%/%user%/web/%domain%/document_errors/;
    }

    location @fallback {
        proxy_pass      https://%ip%:%web_ssl_port%;
    }

    disable_symlinks if_not_owner from=%docroot%;

    include %home%/%user%/conf/web/snginx.%domain%.conf*;
}
bianca446
Posts: 3
Joined: Sat Oct 04, 2025 8:22 pm

Thanks for the guide! Just to add a tip: after editing the ports and setting your OPENSEARCH_INITIAL_ADMIN_PASSWORD, you can also verify everything is running with:

docker ps


This will show the containers and their mapped ports. Then you can access OpenSearch at http://localhost:9202 (or whichever port you chose).

Also, if you want it to start automatically on boot, you can use:

docker-compose restart -d


Nice and straightforward setup for Debian with Docker!
Post Reply