fluentd-docker-image
fluentd-docker-image copied to clipboard
Customized dockerfile cannot work
Hi,
I am creating a customized dockerfile for installing plugins like elasticsearch here is my dockerfile
FROM fluent/fluentd:ubuntu-base
USER ubuntu
WORKDIR /home/ubuntu
ENV PATH /home/ubuntu/.gem/ruby/2.2.0/bin:$PATH
# install plugins
RUN gem install fluent-plugin-secure-forward && \
gem install fluent-plugin-elasticsearch
EXPOSE 24224
CMD fluentd -c /fluentd/etc/$FLUENTD_CONF -p /fluentd/plugins $FLUENTD_OPT
However, this dockerfile cannot work for me. there is no data in /fluentd/logs/*
ubuntu@3527aba5df6d:~$ ls -al /fluentd/log/*
ls: cannot access /fluentd/log/*: No such file or directory
but if I modify base dockerfile directly (by just adding gem install commands and REMOVE onbuild commands), it works.
FROM ubuntu:14.04
MAINTAINER TAGOMORI Satoshi <[email protected]>
LABEL Description="Fluentd docker image" Vendor="Fluent Organization" Version="1.0"
RUN apt-get update -y && apt-get install -y \
autoconf \
bison \
build-essential \
curl \
git \
libffi-dev \
libgdbm3 \
libgdbm-dev \
libncurses5-dev \
libreadline6-dev \
libssl-dev \
libyaml-dev \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
RUN useradd ubuntu -d /home/ubuntu -m -U
RUN chown -R ubuntu:ubuntu /home/ubuntu
# for log storage (maybe shared with host)
RUN mkdir -p /fluentd/log
# configuration/plugins path (default: copied from .)
RUN mkdir -p /fluentd/etc
RUN mkdir -p /fluentd/plugins
RUN chown -R ubuntu:ubuntu /fluentd
USER ubuntu
WORKDIR /home/ubuntu
RUN git clone https://github.com/tagomoris/xbuild.git /home/ubuntu/.xbuild
RUN /home/ubuntu/.xbuild/ruby-install 2.2.2 /home/ubuntu/ruby
ENV PATH /home/ubuntu/ruby/bin:$PATH
RUN gem install fluentd -v 0.12.19
# install plugins
RUN gem install fluent-plugin-secure-forward && \
gem install fluent-plugin-elasticsearch
COPY fluent.conf /fluentd/etc/
#######ONBUILD COPY fluent.conf /fluentd/etc/
#######ONBUILD COPY plugins /fluentd/plugins/
WORKDIR /home/ubuntu
ENV FLUENTD_OPT=""
ENV FLUENTD_CONF="fluent.conf"
EXPOSE 24224
### docker run -p 24224 -v `pwd`/log: -v `pwd`/log:/home/ubuntu/log fluent/fluentd:latest
CMD exec fluentd -c /fluentd/etc/$FLUENTD_CONF -p /fluentd/plugins $FLUENTD_OPT
seems we have an issue on ONBUILD commands.
indeed on a tagged version like v0.12.21 there shouldn't be any onbuild command i'd say you should create an "onbuild" branch where you have the onbuild commands and release separate tags for onbuild versions, like "v0.12.21-onbuild"
i think that's the way the official images are built, like https://hub.docker.com/_/maven/ for instance
@tagomoris How about this approach? > separate tags
This official document also says so. Sounds good to do it. https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#onbuild
i have this and it works
FROM fluent/fluentd:v0.12.21
USER fluent
WORKDIR /home/fluent
ENV PATH /home/fluent/.gem/ruby/2.2.0/bin:$PATH
RUN gem install fluent-plugin-secure-forward && \
gem install fluent-plugin-elasticsearch
EXPOSE 24284
CMD fluentd -c /fluentd/etc/$FLUENTD_CONF -p /fluentd/plugins $FLUENTD_OPT
hi ! any news on this issue ?
please have a look at my fork : https://github.com/mazerty/fluentd-docker-image since i can't create a pull request to create a new branch upstream this is what my fork do :
- create a new branch named "onbuild" from the last commit on master
- create a new tag on this branch with the name v0.12.25-onbuild
- remove the "onbuild" commands in the Dockerfile on master
- create a new tag on master with the name v0.12.25
that should do the trick, and now we can extend the base image without problem thanks !
@mazerty Could you send a PR to compare the diff?
done you'll have to create the onbuild branch and the two tags yourself though, it seems it can't be done through a pull request
I just released two tags for normal and onbuild: https://hub.docker.com/r/fluent/fluentd/tags/
these changes completely break any current downstream containers.
i have "children" containers based on docker tag 0.12.21, and am unable to simply upgrade them to 0.12.26 because of these changes...
i wish this was rolled into the upgrade to 0.14.0 (with a version change) and in upgrade notes...so the interface would stay the same...
Hmm... simply changed to v0.12.26-onbuild has a problem?