I have several files in a directory on the host machine which I am trying to copy to the Docker container.
The problem is that the files do get copied to the destination but all the existing files inside the destination directory get removed.
Before adding these new ADD
lines to my Dockerfile, I had like 20 jar files in the lib directory, by adding these ADD
lines the two crowd files below, all 20 existing jar files get deleted and the directory will now contains only two crowd files which were just copied from the host into the container!
This is my Dockerfile, I build it with docker build . --no-cache -t mine/guacamole
and I have q a docker-compose file which creates the containers and starts them.
I tried without the user ROOT
but it would not copy the server.xml
and tomcat.keystore
FROM guacamole/guacamole
RUN sed -i 's/redirectPort="8443"/redirectPort="8443" server="" secure="true"/g' /usr/local/tomcat/conf/server.xml \
&& sed -i 's/<Server port="8005" shutdown="SHUTDOWN">/<Server port="-1" shutdown="SHUTDOWN">/g' /usr/local/tomcat/conf/server.xml \
&& rm -rf /usr/local/tomcat/webapps/docs/* \
&& rm -rf /usr/local/tomcat/webapps/examples/* \
&& rm -rf /usr/local/tomcat/webapps/manager/* \
&& rm -rf /usr/local/tomcat/webapps/host-manager/*
WORKDIR /usr/local/tomcat
USER root
COPY server.xml conf/server.xml
RUN chmod 660 conf/server.xml
USER root
ADD tomcat.keystore /usr/local/tomcat/
RUN chmod 644 tomcat.keystore
RUN chown root:staff /usr/local/tomcat/tomcat.keystore
ADD ./lib/crowd-auth-filter-1.0.0.jar /usr/local/tomcat/webapps/guacamole/WEB-INF/lib/crowd-auth-filter-1.0.0.jar
ADD ./lib/crowd-filter.properties /usr/local/tomcat/webapps/guacamole/WEB-INF/lib/crowd-filter.properties
RUN chmod 644 /usr/local/tomcat/webapps/guacamole/WEB-INF/lib/crowd-filter.properties
ADD web.xml /usr/local/tomcat/webapps/guacamole/WEB-INF/web.xml
CMD /usr/local/tomcat/bin/shutdown.sh && /usr/local/tomcat/bin/startup.sh
Can someone please help?
Thanks