首页 > 解决方案 > 无法将 Docker CLI 连接到 minikube 内的远程 Docker 恶魔

问题描述

我无法将 Docker CLI 连接到 minikube 内的远程 Docker 恶魔。

我已经完成了minikube deleteminikube start --driver=hyperv 但是当我这样做时,minikube -p minikube docker-env | Invoke-Expression它会返回一个奇怪的错误,即:

You: The term 'You' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Invoke-Expression: Cannot bind argument to parameter 'Command' because it is an empty string.
Invoke-Expression:
Line |
   1 |  & minikube -p minikube docker-env | Invoke-Expression
     |                                      ~~~~~~~~~~~~~~~~~
     | The string is missing the terminator: '.

有人可以帮忙吗?

标签: kubernetesminikube

解决方案


这是为更好的可见性而发布的社区 wiki 答案。随意扩展它。

正如评论中已经讨论的那样,解决方案是使用minikube docker-env 命令

minikube docker-env

配置环境以使用 minikube 的 Docker 守护进程

概要

设置 docker 环境变量;类似于$(docker-machine env)

minikube docker-env [flags]

注意--shell选项:

  --shell string   Force environment to be configured for a specified shell: [fish, cmd, powershell, tcsh, bash, zsh], default is auto-detect

推荐阅读