aliyun / logstash-output-oss

Other
17 stars 3 forks source link

[Question] how to build a docker image with the plugin? #2

Open tulingfeng opened 5 years ago

tulingfeng commented 5 years ago

Hi,I want to know how to build docker image with the plugin.The following is my dockerfile:

FROM docker.elastic.co/logstash/logstash:6.6.0
USER root
RUN ./bin/logstash-plugin install logstash-output-oss
RUN yum -y install rubygems
RUN gem install bundler -v '1.16.1'
RUN bundle config --global silence_root_warning 1
RUN bundle install
USER logstash

but when I built the image an error had occurred(when RUN bundle install was executed ): There was an error while loadinglogstash-core-plugin-api.gemspec: No such file or directory - /usr/share/logstash/logstash-core-plugin-api/versions-gem-copy.yml. Bundler cannot continue

I hope to get your reply.Thanks!

wujinhu commented 5 years ago

@tulingfeng It seems something wrong with the logstash installation. I will have a try later.

tulingfeng commented 5 years ago

@wujinhu hello,logstash is pulled down firstly,and logstash-output-oss could be found in gemfile.But when RUN bundle install,the error had occured. I didn't know whether you have the true dockfile config to build a logstash docker with this plugin,If yes,can you guide me to finish this?

jizusun commented 2 years ago

Hi @wujinhu Thank you for maintaining this logstash plugin ❤️

With the Dockerfile

ARG ELASTIC_STACK_VERSION=7.16.2
ARG DISTRIBUTION_SUFFIX=-oss

FROM docker.elastic.co/logstash/logstash${DISTRIBUTION_SUFFIX}:${ELASTIC_STACK_VERSION}
USER 1000
RUN ./bin/logstash-plugin install logstash-output-oss

Some outputs of docker building are:

#12 23.16 Installing logstash-output-oss
^B

#12 87.01 [DEPRECATED] `Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env` (called at /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/ruby-maven-3.3.12/lib/ruby_maven.rb:38)
#12 88.43 [ERROR] Error executing Maven.
#12 88.43 [ERROR] 1 problem was encountered while building the effective settings
#12 88.43 [FATAL] Non-parseable settings /usr/share/logstash/.m2/settings.xml: only whitespace content allowed before start tag and not # (position: START_DOCUMENT seen #... @1:1)  @ /usr/share/logstash/.m2/settings.xml, line 1, column 1
#12 88.43 
#12 88.51 Error Errno::ENOENT, retrying 1/10
#12 88.51 No such file or directory - /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-oss-0.1.2-java/deps.lst
#12 102.6 Installation successful
#12 102.9 
#12 102.9 real  1m42.549s
#12 102.9 user  2m59.004s
#12 102.9 sys   0m3.360s
#12 102.9 

As we can see, there are some fatal error, but finally says "installation successful". Can you help me?