Custom image build instructions are outdated?
The readme has two conflicting parts:
- The "How to build your own image" section suggests onbuild images must be used,
- 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?
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
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
pluginsdirectory to work: copied https://github.com/hc-chien/fluent-plugin-nats-streaming/blob/master/lib/fluent/plugin/out_nats-streaming.rb toplugins/(will customise it further for needs), added a<match ...>tofluentd.confand 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.
also (minor), [output_docker1] 'time_format' specified without 'time_key', will be ignored — with the example fluent.conf
also (minor), with the example Dockerfile, if you set the user to be root, temporarily, you don't need sudo, do you?
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.