-
Notifications
You must be signed in to change notification settings - Fork 978
Description
I created a customized image for my project.
Dockerfile:
FROM fluent/fluentd:v1.4.2-debian-2.0
USER root
WORKDIR /home/fluent
ENV PATH /fluentd/vendor/bundle/ruby/2.6.0/bin:$PATH
ENV GEM_PATH /fluentd/vendor/bundle/ruby/2.6.0
ENV GEM_HOME /fluentd/vendor/bundle/ruby/2.6.0
ENV FLUENTD_DISABLE_BUNDLER_INJECTION 1
COPY Gemfile* /fluentd/
RUN buildDeps="sudo make gcc g++ libc-dev libffi-dev"
&& apt-get update
&& apt-get upgrade -y
&& apt-get install
-y --no-install-recommends
$buildDeps net-tools
&& gem install bundler --version 1.16.2
&& bundle config silence_root_warning true
&& bundle install --gemfile=/fluentd/Gemfile --path=/fluentd/vendor/bundle
&& SUDO_FORCE_REMOVE=yes
apt-get purge -y --auto-remove
-o APT::AutoRemove::RecommendsImportant=false
$buildDeps
&& rm -rf /var/lib/apt/lists/*
&& gem sources --clear-all
&& rm -rf /tmp/* /var/tmp/* /usr/lib/ruby/gems//cache/.gem
COPY ./conf/fluent.conf /fluentd/etc/
COPY ./conf/systemd.conf /fluentd/etc/
COPY ./conf/kubernetes.conf /fluentd/etc/
COPY ./conf/prometheus.conf /fluentd/etc/
RUN touch /fluentd/etc/disable.conf
COPY plugins /fluentd/plugins/
COPY entrypoint.sh /fluentd/entrypoint.sh
ENV FLUENTD_OPT=""
ENV FLUENTD_CONF="fluent.conf"
RUN chmod -R 666 /var/log/
RUN chown -R fluent:fluent /var/log/
RUN chmod -R 777 /fluentd/
RUN chown -R fluent:fluent /fluentd/
RUN chmod -R 777 /home/fluent
RUN chown -R fluent:fluent /home/fluent
USER fluent
ENTRYPOINT ["tini", "--", "/fluentd/entrypoint.sh"]
CMD ["fluentd"]
But getting below error in fluentd pod.
Permission denied @ rb_sysopen - /var/log/containers.pos
Solutions tried so far:
- Init containers to change permissions of /var/log. But new log files are getting added with root user.
- Creating pos file inside pod at location /home/fluent/containers.pos but in this approach log files are not readable.
Please help!