问题描述
在Kubernetes中 minikube教程可以使用以下命令来使用Minikube Docker守护进程:
In the Kubernetes minikube tutorial there is this command to use Minikube Docker daemon :
$ eval $(minikube docker-env)
此命令的确切作用是什么,即minikube docker-env
的确切含义是什么?
What exactly does this command do, that is, what exactly does minikube docker-env
mean?
推荐答案
命令minikube docker-env
返回一组Bash环境变量导出,以配置您的本地环境以重新使用Minikube实例中的Docker守护程序.
The command minikube docker-env
returns a set of Bash environment variable exports to configure your local environment to re-use the Docker daemon inside the Minikube instance.
将此输出传递给eval
会使bash评估这些导出并将其生效.
Passing this output through eval
causes bash to evaluate these exports and put them into effect.
您可以通过省略评估步骤并直接运行minikube docker-env
来查看将在Shell中执行的特定命令.但是,这将不会执行配置 –需要为此评估输出.
You can review the specific commands which will be executed in your shell by omitting the evaluation step and running minikube docker-env
directly. However, this will not perform the configuration – the output needs to be evaluated for that.
这是一个工作流程优化,旨在改善您在minikube环境中运行的构建和运行Docker映像的体验.不一定要重新使用minikube的Docker守护程序才能有效地使用minikube,但是这样做会显着提高代码构建-测试-测试周期的速度.
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.
在正常的工作流程中,您的主机上将有一个与minikube中的主机不同的Docker注册表,这需要以下过程来在minikube中构建和运行Docker映像:
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:
- 在主机上构建Docker映像.
- 使用远程注册表或minikube实例的注册表在本地计算机的映像注册表中重新标记构建的映像.
- 将图像推送到远程注册表或minikube.
- (如果使用远程注册表,则)配置具有适当权限的minikube以便从注册表中提取图像.
- 在minikube中设置部署以使用该映像.
通过在Minikube中重新使用Docker注册表,它将变成:
By re-using the Docker registry inside Minikube, this becomes:
- 使用Minikube的Docker实例构建Docker映像.这会将映像推送到Minikube的Docker注册表.
- 在minikube中设置部署以使用该映像.
有关此目的的更多详细信息,请参见迷你库文档.
这篇关于minikube docker-env是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!