Exiting due to GUEST_MOUNT_CONFLICT : While starting minikube

11/23/2020

I am trying to use kubernetes for local deployment using minikube, I want to mount a share a directory between host machine and pods. For this, I am trying to mount directory to minikube. But I already had minikube running on which few deployments were running. I deleted them. But every time I restart minikube with mount I get following error

$ minikube start --mount-string="/var/log:/log" --mount
* minikube v1.14.2 on Ubuntu 18.04
* Using the docker driver based on existing profile
* Starting control plane node minikube in cluster minikube
* Restarting existing docker container for "minikube" ...

X Exiting due to GUEST_MOUNT_CONFLICT: Sorry, docker does not allow mounts to be changed after container creation (previous mount: '', new mount: '/var/log:/log)'

Output for kubectl get all is

kubectl get all
NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP   2s

What am I doing wrong here. I need to mount /var/log:/log in my pods just like docker

-- Pranjal Doshi
docker
kubernetes
minikube

3 Answers

11/24/2020

The error you see happens when you try to change the mount configuration on an existing cluster when using Docker. Docker doesn't allow changing of volumes after the container has been created and thus you cannot change the mount-string on minikube start after the cluster has already been created. More info and source for this behavior can be found here and here.

-- WytrzymaƂy Wiktor
Source: StackOverflow

1/21/2021

You can try

$ minikube mount /Users/user/dir:/opt/dir
$ minikube ssh
$ ls /opt/dir  # this should be mounted within minikube VM

and start minikube initially without any flags

$ minikube start
-- Most Wanted
Source: StackOverflow

12/10/2021

You will have to delete the minikube container first using minikube delete , after that recreate the container with the new mount path minikube start --mount-string="/var/log:/log" --mount
Check this Github Issue for more details

-- Ronald Das
Source: StackOverflow