<p>I have a use case where I need a Docker container under kubernetes to access a hostPath. I'm using minikube, and the container is able to access a folder in the minikube VirtualBox VM. But I can't figure out how to get it to access a folder on the host itself.</p>

<p>I do these commands on the host to create /opt/foo for sharing in the VM:</p>

<pre><code>$ sudo touch /opt/foo/FOO
$ ls /opt/foo
FOO
$ minikube mount -v 5 /opt/foo:/opt/foo
Mounting /opt/foo into /opt/foo on the minikubeVM
This daemon process needs to stay alive for the mount to still be accessible...
ufs starting
</code></pre>

<p>In another window I look in the minikube VM</p>

<pre><code>$ minikube ssh -- sudo ls -la /opt/foo
total 0
drwxrwxr-x 2 root root 0 Jun  1 14:44 .
drwxr-xr-x 5 root root 0 Jun  1 14:44 ..
</code></pre>

<p>Is there another step needed to make the files in that directory accessible?</p>

<p>FYI - use case is a container process creating files that a host process is harvesting. Thus I do not want to use nfs or PersistentVolumes. Host is Centos7. minikube version: v0.19.0.</p>

<p>The problem is the firewall, in Ubuntu this worked for me:</p>

<pre><code>sudo ufw allow in on virbr1
sudo ufw reload
</code></pre>

<p>But you need to figure out the correct interface name via <code>ifconfig</code>.</p>

<p>In my case I did <code>minikube ip</code> to realize the interface was <code>virbr1</code></p>

<p>I found the solution because in the past I had connectivity problems with docker which got resolved with <code>sudo ufw allow in on docker0</code></p>
