Mounting filesystems

How to mount a host directory into the VM

9P Mounts

9P mounts are flexible and work across all hypervisors, but suffers from performance and reliability issues when used with large folders (>600 files). See Driver Mounts as an alternative.

To mount a directory from the host into the guest using the mount subcommand:

  1. minikube mount <source directory>:<target directory>

For example, this would mount your home directory to appear as /host within the minikube VM:

  1. minikube mount $HOME:/host

This directory may then be referenced from a Kubernetes manifest, for example:

  1. {
  2. "apiVersion":"v1",
  3. "kind":"Pod",
  4. "metadata":{
  5. "name":"ubuntu"
  6. },
  7. "spec":{
  8. "containers":[
  9. {
  10. "name":"ubuntu",
  11. "image":"ubuntu:18.04",
  12. "args":[
  13. "bash"
  14. ],
  15. "stdin":true,
  16. "stdinOnce":true,
  17. "tty":true,
  18. "workingDir":"/host",
  19. "volumeMounts":[{
  20. "mountPath":"/host",
  21. "name":"host-mount"
  22. }]
  23. }
  24. ],
  25. "volumes":[
  26. {
  27. "name":"host-mount",
  28. "hostPath":{
  29. "path":"/host"
  30. }
  31. }
  32. ]
  33. }
  34. }

Driver mounts

Some hypervisors, have built-in host folder sharing. Driver mounts are reliable with good performance, but the paths are not predictable across operating systems or hypervisors:

DriverOSHostFolderVM
VirtualBoxLinux/home/hosthome
VirtualBoxmacOS/Users/Users
VirtualBoxWindowsC://Users/c/Users
VMware FusionmacOS/Users/mnt/hgfs/Users
KVMLinuxUnsupported
HyperKitLinuxUnsupported (see NFS mounts)

These mounts can be disabled by passing --disable-driver-mounts to minikube start.

File Sync

See File Sync

Last modified January 17, 2021: Update docs VMware Fusion mount location. (7b1b1ac20)