minikube: macOS mount: mounted directory is empty

Is this a BUG REPORT or FEATURE REQUEST? Bug report

Please provide the following details:

Environment:

Minikube version: v0.25.0

  • OS: macOS 10.13.2
  • VM Driver: hyperkit
  • ISO version: v0.25.1
  • Others: kubernetes v1.7.5

What happened: Tried to mount a host directory into a container. The directory inside the container is empty.

What you expected to happen: The directory inside the container should give access to the mounted directory on the host. At least, that was the behavior when I was using minikube and VirtualBox!

How to reproduce it:

$ eval $(minikube docker-env)
$ mkdir test; cd test; echo 'hello' > test.txt
$ docker run --rm -it -v $(pwd):/testmount alpine
(now inside alpoine container)
/ # cd testmount
/testmount # ls -l
total 0

Anything else do we need to know: Is this not possible when using hyperkit? If not, what is the alternative? I noticed some options relating to NFS, but I didn’t dig too deeply. I’d prefer to just use the standard Docker volume mount mechanism if possible.

Thank you!

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 29
  • Comments: 47 (4 by maintainers)

Most upvoted comments

More than three years since this issue was opened… it is still reproducible under Minikube v1.24.0 and Hyperkit 0.20200908

I’m suffering this issue as well 😞

It’s a poor workaround to be sure, but this command left running in a terminal

minikube mount /Users:/Users

Seems to make the above testcase work as expected

docker run --rm -it -v $(pwd):/testmount alpine

just give up on windows

Is this issue fixed? i’m still having issue on v1.12.1

Workaround this issue by using scp to copy the files into the VM:

scp -ri "$(minikube ssh-key)" "$PWD" docker@$(minikube ip):/tmp
docker run --rm -it -v /tmp:/testmount alpine

Very unreliable 9P mounts on Hyperkit, MacOS 11.6 and minikube 1.23.1 Some files present and with 444 permissions in my host file system are unseen from the container mounting the dir, while some of those files are seen as directories… File flags and attributes are a mess I would say.

I was planning to replace docker desktop with minikube but migration of existing volumes has been very difficult so far, because of these minikube bugs.

My Minikube version is: v1.18.1 Docker version: 20.10.5 OS: Endeavour (Arch base) Linux Kernel: 5.4.101-1-lts54

Currently working by manually running the mount command after start, but shouldnt this be at start?

I do not have the same problem when running with the virtualbox driver. Maybe virtual box should be flagged as the preferred driver instead of Docker: https://minikube.sigs.k8s.io/docs/drivers/

$ minikube start --driver=virtualbox --cpus 4 --memory 8196
πŸ˜„  minikube v1.18.1 on Darwin 11.2.3
    β–ͺ MINIKUBE_ACTIVE_DOCKERD=minikube
✨  Using the virtualbox driver based on user configuration
πŸ‘  Starting control plane node minikube in cluster minikube
πŸ”₯  Creating virtualbox VM (CPUs=4, Memory=8196MB, Disk=20000MB) ...
🐳  Preparing Kubernetes v1.20.2 on Docker 20.10.3 ...
    β–ͺ Generating certificates and keys ...
    β–ͺ Booting up control plane ...
    β–ͺ Configuring RBAC rules ...
πŸ”Ž  Verifying Kubernetes components...
    β–ͺ Using image gcr.io/k8s-minikube/storage-provisioner:v4
🌟  Enabled addons: storage-provisioner, default-storageclass
πŸ„  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

$ eval $(minikube docker-env)
$ mkdir test; cd test; echo 'hello' > test.txt
$ docker run --rm -it -v $(pwd):/testmount alpine
Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine
ba3557a56b15: Pull complete
Digest: sha256:a75afd8b57e7f34e4dad8d65e2c7ba2e1975c795ce1ee22fa34f8cf46f96a3be
Status: Downloaded newer image for alpine:latest
/ # ls -l /testmount/
total 4
-rw-r--r--    1 1000     1000             6 Mar 23 19:17 test.txt
/ #

I’m having the same issue, no directory is being created at all. I’m using minikube v1.8.2

minikube start --mount --mount-string "~/test:/test"                                                            
πŸ˜„  minikube v1.8.2 on Darwin 10.14.6
✨  Using the hyperkit driver based on existing profile
βŒ›  Reconfiguring existing host ...
πŸƒ  Using the running hyperkit "minikube" VM ...
🐳  Preparing Kubernetes v1.17.3 on Docker 19.03.6 ...
πŸš€  Launching Kubernetes ...
πŸ“  Creating mount ~/test:/test ...
🌟  Enabling addons: default-storageclass, storage-provisioner
πŸ„  Done! kubectl is now configured to use "minikube"

❗  /usr/local/bin/kubectl is v1.15.5, which may be incompatible with Kubernetes v1.17.3.
πŸ’‘  You can also use 'minikube kubectl -- get pods' to invoke a matching version

minikube ssh                                                                                                

$ ls
$ cd ..
$ ls
docker
$ cd ..
$ ls
bin   dev  home  lib	libexec  media	opt   root  sbin  sys  usr
data  etc  init  lib64	linuxrc  mnt	proc  run   srv   tmp  var

I had a similar problem on M1 Mac and ended up solving it using this command:

minikube mount /Users:/Users

+1 same issue here