Minikube mount doesn't notify container when files change on the host

3/30/2018

I'm using minikube mount to mount a file system from the host to minikube and then to the container (pod). When I do tail -f FILE in the container and change the FILE from the host, I cannot see the changes. However, when I close the tail and run that again, it reads the file from the file system again and works fine.

I'm using Debian (host), VirtualBox and minikube 0.25.2.

Does anyone know what could be the reason?

-- Afshin Mehrabani
docker
kubernetes
minikube

2 Answers

3/30/2018

My guess is that you edited the FILE using some editor like VIM. Correct me if I'm wrong.

VIM does not change the file in place, but rather saves the content to a new file and copies the new file to override the old one. This breaks the mount mechanism which is based on inode and the inotify functionality.

You can see the inode changes:

$ stat testfile
... Inode: 1181459
$ vim testfile    # and do some change
$ stat testfile
... Inode: 1181460
-- Yuankun
Source: StackOverflow

3/30/2018

Minikube use a VirtualBox with Linux vm to execute Docker inside by default installation. Mounted resources are not directly pointed to the destination due to OverlayFS limitation. It may causes minikube vm to become corrupted on file system level.

You may concern to run minikube with --vm-driver=none.

-- d0bry
Source: StackOverflow