title: Docker tomcat editing configuration files through dockerfile
body: <p>I have created a dockerfile and docker-compose like below, which is suppost to create an image of tomcat inside my container and edit the tomcat users so that I am able to access the manager gui.<br>
  The four files below are all in the same folder as where I run the <em>docker-compose up</em> command.</p>
  
  <p><strong>docker-compose.yml</strong>  </p>
  
  <pre><code>version: '2'
  
  services:
    tomcat:
      build: .
      container_name: development
      ports:
        - 8001:8080
      environment:
        - spring.profiles.active=development
  </code></pre>
  
  <p><strong>Dockerfile</strong></p>
  
  <pre><code>FROM tomcat
  COPY tomcat-users.xml /usr/local/tomcat/conf/
  COPY context.xml /usr/local/tomcat/webapps/manager/META-INF/
  CMD ["catalina.sh","run"]
  </code></pre>
  
  <p><strong>tomcat-users.xml</strong>  </p>
  
  <pre><code>&lt;?xml version='1.0' encoding='cp1252'?&gt;
  &lt;tomcat-users xmlns="http://tomcat.apache.org/xml"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
            version="1.0"&gt;
      &lt;user username="manager" password="pass" roles="manager-gui,manager-script"/&gt;
      &lt;user username="admin" password="pass" roles="tomcat"/&gt;
  &lt;/tomcat-users&gt;
  </code></pre>
  
  <p><strong>context.xml</strong>  </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Context antiResourceLocking="false" privileged="true" &gt;
     &lt;!--&lt;Valve className="org.apache.catalina.valves.RemoteAddrValve"
          allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" /&gt;--&gt;
  &lt;/Context&gt;  
  </code></pre>
  
  <p>when I run the command <em>docker-compose up</em>, it generates the container with a tomcat image perfectly, but the existing tomcat-users.xml and context.xml didn't get overwritten. Any idea what I'm doing wrong to overwrite those two files?  </p>