title: How do I enable Kerberos for the mount command in a Docker container?
body: <p>Can someone tell me how to make <code>mount</code> recognize <code>-o sec=krb5</code> as a valid option in a docker container or dockerfile?</p>
  
  <p>Does Ubuntu 16.04 require a reboot for <code>mount</code> to understand Kerberos?
  There doesn't appear to be any information on this online. I only find articles about Red Hat which aren't helpful.</p>
  
  <p>Below is the dockerfile I’ve been using to try and figure it out.</p>
  
  <pre><code>FROM ubuntu:16.04
  ADD krb5.conf krb5.keytab /etc/
  RUN apt-get update &amp;&amp; apt-get install -y krb5-user nfs-common
  </code></pre>
  
  <p>I launch the new image in a container using the following.</p>
  
  <p><code>sudo docker run --name test_krb --privileged -it test_krb /bin/bash</code></p>
  
  <p>Inside the container, I can use <code>kinit</code> without any issues, so I know Kerberos is working. However, <code>mount</code> doesn't understand it for some reason. </p>
  
  <p>Below is the mount command I’ve been running inside of the container along with the output.</p>
  
  <pre><code>$ mount -vo sec=krb5,port=2050 &lt;hostname&gt;:/ /mnt/nfs
  mount.nfs: timeout set for Thu Sep 20 04:06:45 2018
  mount.nfs: trying text-based options 'sec=krb5,port=2050,vers=4,addr=X.X.X.X,clientaddr=X.X.X.X'
  mount.nfs: mount(2): Invalid argument
  mount.nfs: an incorrect mount option was specified
  </code></pre>
  
  <p>I’ve tried this in a VM running the same commands and it failed as well until I rebooted the VM. A reboot appears to be necessary to make this work, but I’m not sure how to accomplish this in a container/dockerfile.</p>
  
  <p>Thanks</p>