<p>In the Kubernetes <a href="https://kubernetes.io/docs/tutorials/hello-minikube/#create-your-node-js-application" rel="noreferrer">minikube tutorial</a> there is this command to use Minikube Docker daemon :</p>

<pre><code>$ eval $(minikube docker-env)
</code></pre>

<p>What exactly does this command do, that is, what exactly does <code>minikube docker-env</code> mean? </p>

Satyajit Das
<p>The command <code>minikube docker-env</code> returns a set of Bash environment variable exports to configure your local environment to re-use the Docker daemon inside the Minikube instance.</p>
<p>Passing this output through <code>eval</code> causes bash to evaluate these exports and put them into effect.</p>
<p>You can review the specific commands which will be executed in your shell by omitting the evaluation step and running <code>minikube docker-env</code> directly. However, <em>this will not perform the configuration</em> – the output needs to be evaluated for that.</p>
<hr />
<p>This is a workflow optimization intended to improve your experience with building and running Docker images which you can run inside the minikube environment. It is not mandatory that you re-use minikube's Docker daemon to use minikube effectively, but doing so will significantly improve the speed of your code-build-test cycle.</p>
<p>In a normal workflow, you would have a separate Docker registry on your host machine to that in minikube, which necessitates the following process to build and run a Docker image inside minikube:</p>
<ol>
<li>Build the Docker image on the host machine.</li>
<li>Re-tag the built image in your local machine's image registry with a remote registry or that of the minikube instance.</li>
<li>Push the image to the remote registry or minikube.</li>
<li>(If using a remote registry) Configure minikube with the appropriate permissions to pull images from the registry.</li>
<li>Set up your deployment in minikube to use the image.</li>
</ol>
<p>By re-using the Docker registry inside Minikube, this becomes:</p>
<ol>
<li>Build the Docker image using Minikube's Docker instance. This pushes the image to Minikube's Docker registry.</li>
<li>Set up your deployment in minikube to use the image.</li>
</ol>
<hr />
<p>More details of the purpose can be found in the <a href="https://minikube.sigs.k8s.io/docs/handbook/pushing/#1-pushing-directly-to-the-in-cluster-docker-daemon-docker-env" rel="noreferrer">minikube docs</a>.</p>
