I am trying to create a dockerfile that will have image 1 and image 2 pulled from dockerhub. It seems that second image is overriding the changes of first image. How to handle this scenario.
FROM clamav/clamav:1.1
COPY clamd.conf /etc/clamav
EXPOSE 3310/tcp
RUN echo $(ls -ltrh var/log) # this is showing the appname as the result
FROM fluent/fluentd:v1.14-1
COPY fluent.conf /fluentd/etc/
RUN echo $(ls -ltrh var/log) # now this is showing no result, empty directory.
2
Answers
@pgossa, what about this one. maybe not a good approach as you mentioned but will it work? just a thought.
The second
FROM
instructions is pulling a new image(fluentd) which delete the changes made in your first one(clamav).If you want to create 2 images then you need 2 dockerfile.
And so split your file in two.
If you are planning on having only one image containing both applications, your dockerfile should look something like this: