Installing OpenSearch with Docker on Debian

Post Reply
User avatar
isscbta
Team Member
Posts: 161
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
Now set an initial admin password (use your own random one, the password must contains one lowercase letter, one uppercase letter, one number, one special character, and minimum 8 characters long password):

Code: Select all

export OPENSEARCH_INITIAL_ADMIN_PASSWORD='some_Pa55word'
Run it:

Code: Select all

docker-compose up
(Press CTRL+D to de-attach yourself if everything looks fine)


--

To switch from HTTPS to HTTP, add the following line to the `environment:` block for both nodes (`opensearch-node1` and `opensearch-node2`) in the `docker-compose.yml` file:

Code: Select all

  - plugins.security.ssl.http.enabled=false
In `opensearch-dashboards:` block, change:

Code: Select all

OPENSEARCH_HOSTS: '["https://opensearch-node1:9200","https://opensearch-node2:9200"]'
to:

Code: Select all

OPENSEARCH_HOSTS: '["http://opensearch-node1:9200","http://opensearch-node2:9200"]'
---

To disable authentication, add the following line to the `environment:` block for both nodes (`opensearch-node1` and `opensearch-node2`):

Code: Select all

- DISABLE_SECURITY_PLUGIN=true
and remove:

Code: Select all

  - OPENSEARCH_INITIAL_ADMIN_PASSWORD=${OPENSEARCH_INITIAL_ADMIN_PASSWORD}
  - plugins.security.ssl.http.enabled=false
For `opensearch-dashboards:`, add the following line to the `environment:` block:

Code: Select all

  - DISABLE_SECURITY_DASHBOARDS_PLUGIN=true
---

After each modification to the `docker-compose.yml` file, run:

Code: Select all

docker-compose down
docker-compose up -d
Test it:

Code: Select all

curl --insecure -u admin:$OPENSEARCH_INITIAL_ADMIN_PASSWORD https://localhost:9200/?pretty
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:

Code: Select all

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:

Code: Select all

docker-compose restart -d

Nice and straightforward setup for Debian with Docker!
User avatar
myVesta
Site Admin
Posts: 1002
Joined: Fri Jun 19, 2020 9:59 am
Has thanked: 11 times
Been thanked: 6 times

bianca446 wrote: Sat Oct 04, 2025 8:26 pm Also, if you want it to start automatically on boot, you can use:

Code: Select all

docker-compose restart -d
I'm not sure this is correct.

My way is the following:

Code: Select all

docker ps
See "Container ID" column value.

Then:

Code: Select all

docker update --restart unless-stopped [CONTAINER_ID_VALUE]
For example:

Code: Select all

docker update --restart unless-stopped 39ac837fcce5
Post Reply