Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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/
like image 642
Ravindu Nirmal Fernando Avatar asked Aug 24 '17 12:08

Ravindu Nirmal Fernando


People also ask

Where is the docker root directory?

You can get the basic information about your Docker configuration by executing: $ docker info ... Storage Driver: overlay2 Docker Root Dir: /var/lib/docker ... The output contains information about your storage driver and your docker root directory.


1 Answers

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/
like image 159
Rob Blake Avatar answered Sep 20 '22 12:09

Rob Blake