Run OpenSearch Dashboards using Docker and Docker Compose
You can use either Docker or Docker Compose to run OpenSearch Dashboards. The Docker Compose method is easier because you can define the entire configuration in a single file.
Run OpenSearch Dashboards using Docker
If you have defined your network using docker network create os-net
and started OpenSearch using the following command:
docker run -d --name opensearch-node -p 9200:9200 -p 9600:9600 --network os-net -e "discovery.type=single-node" -e "OPENSEARCH_INITIAL_ADMIN_PASSWORD=<admin_password>" opensearchproject/opensearch:latest
Then you can start OpenSearch Dashboards using the following steps:
-
Create an
opensearch_dashboards.yml
configuration file:server.name: opensearch_dashboards server.host: "0.0.0.0" server.customResponseHeaders : { "Access-Control-Allow-Credentials" : "true" } # Disabling HTTPS on OpenSearch Dashboards server.ssl.enabled: false opensearch.hosts: ["https://opensearch-node:9200"] # Using the opensearch container name opensearch.ssl.verificationMode: none opensearch.username: kibanaserver opensearch.password: kibanaserver opensearch.requestHeadersWhitelist: ["securitytenant","Authorization"] # Multitenancy opensearch_security.multitenancy.enabled: true opensearch_security.multitenancy.tenants.preferred: ["Private", "Global"] opensearch_security.readonly_mode.roles: ["kibana_read_only"]
-
Execute the following command to start OpenSearch Dashboards:
docker run -d --name osd \ --network os-net \ -p 5601:5601 \ -v ./opensearch_dashboards.yml:/usr/share/opensearch-dashboards/config/opensearch_dashboards.yml \ opensearchproject/opensearch-dashboards:latest
Run OpenSearch Dashboards using Docker Compose
Use the following steps to run OpenSearch Dashboards using Docker Compose:
-
Create a
docker-compose.yml
file appropriate for your environment. A sample file that includes OpenSearch Dashboards is available on the OpenSearch Docker installation page.You can pass a custom
opensearch_dashboards.yml
file to the container in the Docker Compose file. For more information, see Complete Docker Compose example with custom configuration. -
Create an
opensearch_dashboards.yml
file:server.name: opensearch_dashboards server.host: "0.0.0.0" server.customResponseHeaders : { "Access-Control-Allow-Credentials" : "true" } # Disabling HTTPS on OpenSearch Dashboards server.ssl.enabled: false opensearch.ssl.verificationMode: none opensearch.username: kibanaserver opensearch.password: kibanaserver opensearch.requestHeadersWhitelist: ["securitytenant","Authorization"] # Multitenancy opensearch_security.multitenancy.enabled: true opensearch_security.multitenancy.tenants.preferred: ["Private", "Global"] opensearch_security.readonly_mode.roles: ["kibana_read_only"]
The
opensearch.hosts
setting must be configured if you are not passing it as an environment variable. For an example of how to configure this setting, see Complete Docker Compose example with custom configuration. -
Run
docker compose up
.Wait for the containers to start. Then see the OpenSearch Dashboards documentation.
-
When finished, run
docker compose down
.