This Docker image extends the official OpenSearch image to support environment variable translation from snake_case to dot notation, making it compatible with Bitbucket Pipelines' environment variable constraints.
- Environment variable translation from snake_case to dot notation
- Pre-installed plugins:
- analysis-icu
- analysis-phonetic
Pre-built images are available on Docker Hub: aligent/bitbucket-opensearch
docker pull aligent/bitbucket-opensearch:latest
docker pull aligent/bitbucket-opensearch:2.12.0
Bitbucket Pipelines services:
- Cannot have custom commands or entry-points
- Can only use environment variables with alphanumeric characters and underscores (no dots)
This image automatically translates environment variables prefixed with OPENSEARCH_SETTING_
from snake_case to OpenSearch's dot notation configuration format.
Environment variables starting with OPENSEARCH_SETTING_
are automatically translated:
Environment Variable | Translated Setting |
---|---|
OPENSEARCH_SETTING_CLUSTER_NAME |
cluster.name |
OPENSEARCH_SETTING_NODE_NAME |
node.name |
OPENSEARCH_SETTING_HTTP_PORT |
http.port |
OPENSEARCH_SETTING_PLUGINS_SECURITY_DISABLED |
plugins.security.disabled |
Use double underscores (__
) to preserve a single underscore in the setting name:
Environment Variable | Translated Setting |
---|---|
OPENSEARCH_SETTING_CLUSTER_ROUTING_ALLOCATION_DISK_WATERMARK__LOW |
cluster.routing.allocation.disk.watermark_low |
docker build -t your-registry/opensearch-bitbucket:latest .
# Build a specific OpenSearch version
docker build --build-arg OPENSEARCH_VERSION=2.11.0 -t your-registry/opensearch-bitbucket:2.11.0 .
definitions:
services:
opensearch:
image: aligent/bitbucket-opensearch:latest
variables:
discovery.type: single-node
OPENSEARCH_INITIAL_ADMIN_PASSWORD: MyStrongPassword123!
OPENSEARCH_SETTING_CLUSTER_NAME: my-cluster
OPENSEARCH_SETTING_NODE_NAME: opensearch-node-1
OPENSEARCH_SETTING_HTTP_PORT: 9200
OPENSEARCH_SETTING_PLUGINS_SECURITY_DISABLED: true
pipelines:
default:
- step:
name: Run Tests with OpenSearch
services:
- opensearch
script:
- echo "Waiting for OpenSearch to start..."
- sleep 30
- curl -s http://localhost:9200
- # Run your tests here
# Build the image
docker build -t opensearch-bitbucket:test .
# Run a test container
docker run -d \
--name opensearch-test \
-e "discovery.type=single-node" \
-e "OPENSEARCH_INITIAL_ADMIN_PASSWORD=MyStrongPassword123!" \
-e "OPENSEARCH_SETTING_CLUSTER_NAME=test-cluster" \
-e "OPENSEARCH_SETTING_NODE_NAME=test-node" \
-e "OPENSEARCH_SETTING_PLUGINS_SECURITY_DISABLED=true" \
-p 9200:9200 \
opensearch-bitbucket:test
# Verify it's working
curl http://localhost:9200
# Check the logs to see environment variable translation
docker logs opensearch-test 2>&1 | grep "Translated:"
# Cleanup
docker stop opensearch-test && docker rm opensearch-test
This repository is configured for Docker Hub automated builds with support for multiple OpenSearch versions.
latest
- Latest stable OpenSearch version (2.12.0)2.12.0
,2.12
,2
- OpenSearch 2.12.0- Version-specific tags for other OpenSearch releases
The repository includes Docker Hub build hooks for:
- hooks/build - Handles version-specific builds using build arguments
- hooks/post_push - Creates additional semantic version tags (e.g., 2.12.0 → 2.12, 2)
To build a specific OpenSearch version locally:
docker build --build-arg OPENSEARCH_VERSION=2.11.0 -t opensearch-bitbucket:2.11.0 .
Dockerfile
- Extends the official OpenSearch image with build argument support for version flexibilityentrypoint.sh
- Custom entrypoint script that handles environment variable translation from snake_case to dot notationhooks/
- Docker Hub automated build hooksbuild
- Handles version-specific builds using build argumentspost_push
- Creates additional semantic version tags (e.g., 2.12.0 → 2.12, 2)
This project is licensed under the MIT License - see the LICENSE file for details.