简体   繁体   中英

How to remove ROOT folder from a Docker Container running Tomcat base image

I want to know whether if there is any method to remove the ROOT folder within the tomcat /webapps folder after its being deployed by a Docker image.

The reason that I want to achieve this is that I want to run my .war file as the root. I have already renamed my war file as ROOT.war. But when I run my Docker image with the tomcat base image, a ROOT folder is also created by default within the container's tomcat/webapps folder which doesn't allow me to access my ROOT.war file as the root.

My Dockerfile

# Pull base image
FROM tomcat:8.0.30-jre7

# Copy to images tomcat path
COPY /ROOT.war /usr/local/tomcat/webapps/

Sure. You can just delete the already existing ROOT folder as part of your Dockerfile:

# Pull base image
FROM tomcat:8.0.30-jre7

# Delete existing ROOT folder
RUN rm -rf /usr/local/tomcat/webapps/ROOT

# Copy to images tomcat path
COPY ROOT.war /usr/local/tomcat/webapps/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM