Adam Zarn
Adam Zarn

Reputation: 2100

How to upgrade elasticsearch in ELK Docker Image

I have installed an elk docker image on a Linux server using the following command:

sudo docker pull sebp/elk

This pulls the latest version of the elk docker image, which is 7.8.0, and each service in the stack (elasticsearch, logstash, and kibana) also has version 7.8.0.

I need to upgrade elasticsearch to 7.9.0 for security reasons. How can I do this while continuing to use the sebp/elk docker image?

Upvotes: 0

Views: 3912

Answers (1)

Suman
Suman

Reputation: 868

Elk comes up package and runs all 3 services and links them by default. With this setup, you can’t split and upgrade only elasticsearch.

I recommend you to run all three services independently using docker-compose. So that each service can have an image of your choice.

Sample docker-compose for your reference:

version: '3.2'

services:
  elasticsearch:
    image: IMAGE_GOES_HERE
    volumes:
      - type: bind
        source: ./elasticsearch/config/elasticsearch.yml
        target: /usr/share/elasticsearch/config/elasticsearch.yml
        read_only: true
      - type: volume
        source: elasticsearch
        target: /usr/share/elasticsearch/data
    ports:
      - "9200:9200"
      - "9300:9300"
    environment:
      ES_JAVA_OPTS: "-Xmx256m -Xms256m"
      ELASTIC_PASSWORD: changeme
      # Use single node discovery in order to disable production mode and avoid bootstrap checks
      # see https://www.elastic.co/guide/en/elasticsearch/reference/current/bootstrap-checks.html
      discovery.type: single-node
    networks:
      - elk

  logstash:
    image: IMAGE_GOES_HERE
    volumes:
      - type: bind
        source: ./logstash/config/logstash.yml
        target: /usr/share/logstash/config/logstash.yml
        read_only: true
      - type: bind
        source: ./logstash/pipeline
        target: /usr/share/logstash/pipeline
        read_only: true
    ports:
      - "5000:5000/tcp"
      - "5000:5000/udp"
      - "9600:9600"
    environment:
      LS_JAVA_OPTS: "-Xmx256m -Xms256m"
    networks:
      - elk
    depends_on:
      - elasticsearch

  kibana:
    image: IMAGE_GOES_HERE
    volumes:
      - type: bind
        source: ./kibana/config/kibana.yml
        target: /usr/share/kibana/config/kibana.yml
        read_only: true
    ports:
      - "5601:5601"
    networks:
      - elk
    depends_on:
      - elasticsearch

networks:
  elk:
    driver: bridge

volumes:
  elasticsearch:

Upvotes: 1

Related Questions