I've set up the Docker Engine locally to run on minikube (rather than using Docker Desktop). I know that I need to make sure that the Engine "talks to" the minikube cluster. I've consulted two tutorials, which have slightly different instructions. Specifically for this question, I want to understand the difference between the command:
eval $(minikube -p minikube docker-env)
referenced here, and
eval $(minikube docker-env)
referenced here. What does the profile flag -p do in this case?
Minikube profiles are a way of getting different isolated environments (VMs), which can be helpful in a handful of scenarios (testing how the application behaves on different networks, testing different K8s versions, etc).
By default, the
minikube startwill start a VM with a profile namedminikubethat can be referenced through-p minikubeor--profile minikubeor simply by omitting the profile. So in practiceminikube -p minikube docker-envandminikube docker-envare the same command, butminikube -p otherkube docker-envpoints to a different profile.The command
minikube -p <profile> docker-envprints out a set of environment variables that when evaluated will allow your local docker commands to point to the docker agent inside the specified profile's VM. Theevalcommand will run these exports in the current shell. Setting different profiles will change slightly some of the variables (namely the docker host and the active docker daemon VM).The
minikube -p <profile> docker-envwill fail if the specified profile is stopped. In the same way,minikube docker-envwill fail if theminikubeprofile is stopped.You can get a list of existing profiles using the following command:
You can run the following commands to better understand the difference between the output when using different profiles.