title: Docker Tomcat users configuration not working
body: <p><em>Update: cleanup and directly indicate the problem and the solution.</em></p>
  
  <p><strong>PROBLEM:</strong></p>
  
  <p>Docker-tomcat was properly installed and running, except for the 403 Access error in the Manager App. It also seems that my docker tomcat cannot find my tomcat-users.xml configuration.</p>
  
  <p><strong>SOLUTION</strong></p>
  
  <p>Thanks to <a href="https://stackoverflow.com/users/5867722/farhad-farahi">Farhad</a> and <a href="https://stackoverflow.com/users/7610918/sanket-d">Sanket</a> for the answers.</p>
  
  <p><strong>[Files]:</strong></p>
  
  <p><strong>Dockerfile</strong></p>
  
  <pre><code>FROM tomcat:8.5.11
  MAINTAINER Borgy Manotoy &lt;borgymanotoy@ujeaze.com&gt;
  
  # Update Apt and then install Nano editor (RUN can be removed)
  RUN apt-get update &amp;&amp; apt-get install -y \
      nano \
  &amp;&amp; mkdir -p /usr/local/tomcat/conf
  
  # Copy configurations (Tomcat users, Manager app)
  COPY tomcat-users.xml /usr/local/tomcat/conf/
  COPY context.xml /usr/local/tomcat/webapps/manager/META-INF/
  </code></pre>
  
  <p><strong>Tomcat Users Configuration (conf/tomcat-users.xml)</strong></p>
  
  <pre><code>&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;role rolename="manager-gui"/&gt;
      &lt;role rolename="manager-script"/&gt;
      &lt;user username="admin" password="password" roles="manager-gui,manager-script" /&gt;
  &lt;/tomcat-users&gt;
  </code></pre>
  
  <p><strong>Application Context (webapps/manager/META-INF/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><strong>[STEPS &amp; COMMANDS]:</strong></p>
  
  <ol>
  <li><p>Build Docker Image</p>
  
  <p>docker build -t borgymanotoy/my-tomcat-docker .    </p></li>
  <li><p>Run Image (my-tomcat-docker and set port to 8088)</p>
  
  <p>docker run --name my-tomcat-docker-container -p 8088:8080 -it -d borgymanotoy/my-tomcat-docker    </p></li>
  <li><p>Go to the container's bash (to check files inside the container thru bash)</p>
  
  <p>docker exec -it biyahe-tomcat-docker-container bash    </p></li>
  </ol>