Logstash exits after successfully installing plugin with docker-compose

I am trying to run an Elastic stack and I am trying to install a logstash plugin within the docker file. I am getting the message that the plugin is installed successful and right after that the container exits with code 0.

log01       | Validating logstash-codec-gzip_lines
log01       | Installing logstash-codec-gzip_lines
log01       | Installation successful
log01 exited with code 0

I tried it to install with the Docerfile and with the docker-compose.yml file, but in both ways I am getting the same "error".

Dockerfile

FROM docker.elastic.co/logstash/logstash:7.9.3

# Add your logstash plugins setup here
# Example: RUN logstash-plugin install logstash-filter-json
RUN bin/logstash-plugin install logstash-codec-gzip_lines

docker-compose.yml

...
logstash:
    build:
      context: logstash/
    #image: docker.elastic.co/logstash/logstash:7.9.3
    container_name: log01
    command: 'logstash-plugin install logstash-codec-gzip_lines'
    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
      - type: volume
        source: certs
        target: /usr/share/logstash/config/certs
    ports:
      - 5044:5044
      - 5000:5000
      - 9600:9600
    environment:
      ELASTIC_USERNAME: <USER>
      ELASTIC_PASSWORD: <PASS>
      ELASTICSEARCH_HOST_PORT: https://es01:9200
      #LS_JAVA_OPTS: "-Xmx256m -Xms256m"
      LS_JAVA_OPTS: "-Xmx1g -Xms1g"

    networks:
      - elastic
    depends_on:
      - es01
...

Can anybody tell me why it is exiting, and how can I fix it?

Hi,

Did you manage to solve?

I have the same problem.

at the and, an "--build" helped me. and of course, a deleted the "command" line from the docker-compose.yml

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.