I have the following docker-compose.yml:
version: '3.6'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:5.6.14
container_name: elasticsearch
hostname: elasticsearch
environment:
- node.name=es01
- cluster.name=thor-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx1024m"
ulimits:
nproc: 65535
memlock:
soft: -1
hard: -1
privileged: false
deploy:
mode: global
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
ports:
- 9200:9200
- 9300:9300And the following bitbucket-pipelines:
image: maven:3.3.9-jdk-8
options:
size: 2x
docker: true
pipelines:
default:
- step:
image: atlassian/default-image:2
size: 2x
services:
- docker
caches:
- maven
- node
- docker
script:
- chmod +x dependencies.sh
- ./dependencies.sh
- docker-compose run -d -p 9200:9200 -p 9300:9300 -e "http.host=0.0.0.0" -e "transport.host=127.0.0.1" -e "xpack.security.enabled=false" -e "cluster.name=thor-cluster" elasticsearch
- docker-compose ps
- curl -v -XGET '127.0.0.1:9200/_cluster/health?pretty'
branches:
master:
- step:
name: Features unit tests
caches:
- maven
- node
script:
- mvn clean install -Pmaster-ci
definitions:
services:
docker:
memory: 2048
And the following dependencies.sh script:
set -eu
# Add python pip and bash
apt-get install -y software-properties-common
apt-add-repository universe
apt-get -y update
apt-get install -y python-pip bash
# Install docker-compose via pip
pip install --no-cache-dir docker-compose
docker-compose -v
When I run the pipelines I get the following error when the curl command is invoked:
<span>+ curl -v -XGET '127.0.0.1:9200/_cluster/health?pretty'</span><span>Note: Unnecessary use of -X or --request, GET is already inferred.</span><span>* Trying 127.0.0.1...</span><span> % Total % Received % Xferd Average Speed Time Time Time Current</span><span> Dload Upload Total Spent Left Speed</span><span> 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 127.0.0.1 (127.0.0.1) port 9200 (#0)</span><span>> GET /_cluster/health?pretty HTTP/1.1</span><span>> Host: 127.0.0.1:9200</span><span>> User-Agent: curl/7.47.0</span><span>> Accept: */*</span><span>> </span><span>* Recv failure: Connection reset by peer</span><span> 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0</span><span>* Closing connection 0 </span><span>curl: (56) Recv failure: Connection reset by peer<br><br></span>
However I can see the elasticsearch container up and running:
<span>docker-compose ps<br></span><span>Some services (elasticsearch) use the 'deploy' key, which will be ignored. Compose does not support 'deploy' configuration - use `docker stack deploy` to deploy to a swarm.</span><span> Name Command State Ports </span><span>-----------------------------------------------------------------------------------------------------------------------</span><span>build_elasticsearch_run_d6c8747d086b /bin/bash bin/es-docker Up 0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp</span>