How to transfer files between local machine and minikube?

I handled it by following next steps:

1- going into ssh of minikube >> minikube ssh

2- Changing docker password using sudo >> sudo passwd docker and create new password so now i know docker user password

3- exit from ssh and go back to Ubuntu terminal >> exit

4- using scp command to copy files into minikube >> scp /local/path/to/file/ docker@minikubeIp:/your/destination/folder/

For example scp -r /media/myuser/sourceFolder [email protected]:/home/docker

and after that it asked only for minikube docker user password which i know it now after changed it then write password and folders copied successfully into minikube from local machine


On the host machine you can use the ssh-key and ip subcommands of the minikube command:

scp -i $(minikube ssh-key) <local-path> docker@$(minikube ip):<remote-path>

So the command from the question becomes:

scp -i $(minikube ssh-key) /media/myuser/sourceFolder docker@$(minikube ip):/home/docker/destiationFolder