Mounting filesystems

How to mount a host directory into a cluster

minikube supports the following methods to mount host directories into a cluster:

Method Performance Flexibility
Mount during start Near-native with new drivers Single mount, set at start
Mount command Limited (9p only) Multiple mounts, any time
Driver mounts Varies Legacy drivers only

Mount During Start

The recommended way to mount a host directory. Best for directories that should be available on every run. Uses the best method supported by the driver — virtiofs or container volumes on modern drivers provide near-native performance, while legacy drivers fall back to 9p.

minikube start --mount-string <host directory>:<guest directory>

For example, this would mount your ~/models directory to appear as /mnt/models within the cluster:

minikube start --mount-string ~/models:/mnt/models

The directory remains mounted while the cluster is running.

Driver OS Method Notes
docker All container volume
podman All container volume
vfkit macOS virtiofs Since minikube 1.37.0
krunkit macOS virtiofs Since minikube 1.37.0
hyperv Windows 9p
kvm Linux 9p
qemu macOS 9p Requires socket_vmnet

Notes

  • Some drivers do not support mounting (see unsupported drivers).
  • Only a single mount is supported. If you need to mount additional directories, or mount and unmount directories after the cluster was started, use the mount command.

Mount Command

Mounts a host directory into a running cluster using the 9p filesystem. Use this when you need to mount multiple directories, or for temporary mounts whose lifecycle is shorter than the cluster (e.g. mount a directory during a test run, then unmount). Works with most drivers (see unsupported drivers) but suffers from performance and reliability issues with large directories (>600 files). Prefer mount during start when possible.

minikube mount <host directory>:<guest directory>

For example:

minikube mount ~/models:/mnt/models

The directory remains mounted while the mount command is running. To unmount, terminate the command with Ctrl+C.

Unsupported Drivers

The following drivers do not support mounting host directories:

  • none
  • qemu with the builtin network — use --network=socket_vmnet (macOS only, selected automatically when socket_vmnet is installed)

Driver mounts

Some legacy drivers have built-in host folder sharing. These mounts are automatic but the paths are not configurable.

Driver OS Host Guest
VirtualBox Linux /home /hosthome
VirtualBox macOS /Users /Users
VirtualBox Windows C://Users /c/Users
VMware Fusion macOS /Users /mnt/hgfs/Users

Built-in mounts can be disabled by passing the --disable-driver-mounts flag to minikube start.

The HyperKit driver also supports NFS mounts via start flags:

  • --nfs-share=[]: Local folders to share with Guest via NFS mounts
  • --nfs-shares-root='/nfsshares': Where to root the NFS shares, defaults to /nfsshares

File Sync

See File Sync