fluentd-docker-image icon indicating copy to clipboard operation
fluentd-docker-image copied to clipboard

Custom image build instructions are outdated?

Open gmile opened this issue 5 years ago • 5 comments

The readme has two conflicting parts:

  1. The "How to build your own image" section suggests onbuild images must be used,
  2. onbuild images are declared deprecated and should not be used.

That said, what would be official way to to build custom images now? The only customization I need is being able to add a fluentd plugin to the image.

Right now I went with cloning the repo, inserting a couple of gem install ... in the middle of the file, next to gem install fluentd and building the image. Is there a better way?

gmile avatar Mar 25 '20 07:03 gmile

Thanks. Just updated README to remove onbuild. We have updated example but forgot to update other sentence...

Build process is still same for your image: https://github.com/fluent/fluentd-docker-image#how-to-build-your-own-image

repeatedly avatar Mar 26 '20 00:03 repeatedly

@repeatedly

Seeing this issue is open still, here's the problems I've just encountered — with the updated instructions:

  • missing $ chmod a+x entrypoint.sh
  • can't get the plugins directory to work: copied https://github.com/hc-chien/fluent-plugin-nats-streaming/blob/master/lib/fluent/plugin/out_nats-streaming.rb to plugins/ (will customise it further for needs), added a <match ...> to fluentd.conf and got: config error file="/fluentd/etc/fluent.conf" error_class=Fluent::ConfigError error="Unknown output plugin 'nats-streaming'. Run 'gem search -rd fluent-plugin' to find plugins"

Your assistance is seriously appreciated — as a pretty cool new system is built with fluentd and nats-streaming.

costa avatar Dec 22 '20 10:12 costa

also (minor), [output_docker1] 'time_format' specified without 'time_key', will be ignored — with the example fluent.conf

costa avatar Dec 22 '20 12:12 costa

also (minor), with the example Dockerfile, if you set the user to be root, temporarily, you don't need sudo, do you?

costa avatar Dec 22 '20 17:12 costa

My workaround — which I'm not too happy about — for posterity:

...
COPY some-custom-plugin-gem-src /some-plugin
RUN apk add --no-cache --update --virtual .build-deps \
        build-base ruby-dev git \
  && gem install fluent-plugin-elasticsearch \
  && cd /some-plugin \
  && gem build some-plugin.gemspec \
  && mv *.gem some-plugin.gem \
  && gem install some-plugin.gem \
  && gem sources --clear-all \
  && apk del .build-deps \
  && rm -rf /home/fluent/.gem/ruby/2.5.0/cache/*.gem \
  && rm -rf /some-plugin
...

P.S. The plugins directory is useless with the instructions anyway.

costa avatar Dec 22 '20 18:12 costa