Problem with shared volume write permissions using minikube as a docker desktop replacement

Viewed 133

So the problem is quite simple,

I want to use minikube with docker for the local development alone, without docker desktop app or kubernetes itself.

Everything works smoothly until I wanted to use a shared volume to persist changes on my local disk after I run minikube delete. My setup is hypervisor + minikube + docker on MacOS system.

To be specific, here is the commands I run:

minikube start --no-kubernetes

minikube mount /private/var/services/:/private/var/services/

docker run --name redis -p 6379:6379 -v /private/var/services/redis:/data redis:5

and the result of the last command is:

docker: Error response from daemon: error while creating mount source path '/private/var/services/redis': mkdir /private/var/services/redis: errno 526.

I tried to do the same with mongodb and result is always the same: lack of permissions to write to the shared volume.

If I change volume on docker to be somewhere else: eg.: docker run --name redis -p 6379:6379 -v /tmp/redis:/data redis:5 – it works just fine

I already spent some time to debug it, like mounting minikube volume with another gid/uid, but no luck.

Temp solution, that I came up with is mounting to /data/*, but this approach works until first minikube delete command.

Please share what's your experience using minikube as a docker runner

1 Answers

Docker can't create redis directory in /private/var/services. You should fix permissions and ownership. Execute ls -ld /private/var/services to see permissions and id to see your current user.

Related