title: How to initialize a keytab in docker?
body: <p>I have a krb5.conf file. I created a keytab and checked it as expalined <a href="http://www.itadmintools.com/2011/07/creating-kerberos-keytab-files.html" rel="nofollow noreferrer">here</a>.</p>
  
  <p>In docker file I added all of it to the container</p>
  
  <pre><code>FROM java:8
  
  ADD krb5.conf /etc/krb5.conf
  ADD evkuzmin.keytab /etc/evkuzmin.keytab
  ADD scripts/ /opt/scripts/
  
  ADD report.jar report.jar
  RUN sh -c 'touch report.jar'
  ENTRYPOINT ["java","-Dspring.data.mongodb.uri=mongodb://audpro_mongo/report","-Djava.security.egd=file:/dev/./urandom","-jar","/report.jar","/opt/scripts/init-keytab.sh"]
  </code></pre>
  
  <p>And tried to initialize it in init-keytab.sh</p>
  
  <pre><code>#!/bin/bash
  kinit EvKuzmin@REALM -k -t /etc/evkuzmin.keytab
  </code></pre>
  
  <p>But every time I try to access the secured cluster, I get Unauthorized error. And when I check my keytab with</p>
  
  <pre><code>klist -k evkuzmin.keytab
  </code></pre>
  
  <p>I get evkuzmin.keytab not found.</p>
  
  <p>Why?</p>
  
  <p>I use Oracle virtual box and docker quickstrat terminal to test everything localy. Keytab was generated on the server and copied into the project on local machine.</p>
  
  <p>EDIT</p>
  
  <p>I checked files in the image using</p>
  
  <pre><code>docker run -it --entrypoint sh &lt;image-name&gt;
  </code></pre>
  
  <p>they are present.</p>