Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Elasticsearch 5.6.14 docker image not accessible in bitbucket pipelines

Deleted user December 22, 2018

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:9300

And 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:


+ curl -v -XGET '127.0.0.1:9200/_cluster/health?pretty'Note: Unnecessary use of -X or --request, GET is already inferred.* Trying 127.0.0.1... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 127.0.0.1 (127.0.0.1) port 9200 (#0)> GET /_cluster/health?pretty HTTP/1.1> Host: 127.0.0.1:9200> User-Agent: curl/7.47.0> Accept: */*> * Recv failure: Connection reset by peer 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Closing connection 0 curl: (56) Recv failure: Connection reset by peer


However I can see the elasticsearch container up and running: 

docker-compose ps
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. Name Command State Ports -----------------------------------------------------------------------------------------------------------------------build_elasticsearch_run_d6c8747d086b /bin/bash bin/es-docker Up 0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events