简体   繁体   English

为什么 docker ps 不显示我的 minikube 的 docker 容器?

[英]Why does docker ps not show my minikube's docker containers?

I am running minikube using the instructions at我正在使用以下说明运行 minikube

https://kubernetes.io/docs/tutorials/hello-minikube/ https://kubernetes.io/docs/tutorials/hello-minikube/

I started minikube:我开始了 minikube:

$ minikube start --vm-driver=hyperkit

and verified that it is successfully running.并验证它已成功运行。

I am running 'Docker Community Edition' version 18.06.1-ce-mac73.我正在运行“Docker 社区版”版本 18.06.1-ce-mac73。

$ minikube ssh

is working fine.工作正常。

However when I do但是当我做

$ docker ps

on my mac os host, it doesn't show any containers.在我的 mac os 主机上,它没有显示任何容器。 However, when I do但是,当我这样做时

$ docker ps 

after doing minikube ssh, I see about 20 containers.做 minikube ssh 后,我看到大约 20 个容器。

So, where are the docker containers really running?那么,docker 容器真正运行在哪里呢? Why does docker ps not show any containers on my mac?为什么 docker ps 在我的 Mac 上没有显示任何容器?

Thank you.谢谢你。

You can use the following command to configure your Docker Host address:您可以使用以下命令来配置您的 Docker 主机地址:

eval $(minikube docker-env)

Then, when you run docker ps , you should see your containers.然后,当您运行docker ps ,您应该会看到您的容器。 Read more here .在这里阅读更多。

Docker containers are not running on your MAC host. Docker 容器未在您的 MAC 主机上运行。

They are running on a VM where you can do minikube ssh to that VM.它们在 VM 上运行,您可以在其中对该 VM 执行minikube ssh

The docker ps shows the containers in there inside that VM. docker ps 显示该 VM 中的容器。

That's expected because you are using hyperkit driver to work as a hypervisor & launch lightweight virtual machines.这是意料之中的,因为您使用hyperkit驱动程序作为管理程序工作并启动轻量级虚拟机。 Think of it as virtualbox launching VMs for you & complete k8s cluster is deployed into those VMs, all of them are well integrated.把它想象成为你启动虚拟机的虚拟机,完整的 k8s 集群部署到这些虚拟机中,所有这些都很好地集成在一起。

Use below to get your virtual machine address or the server where these containers are actually running -使用下面来获取您的虚拟机地址或这些容器实际运行的服务器 -

$ minikube ip

Ref - https://github.com/moby/hyperkit参考 - https://github.com/moby/hyperkit

Since I can't add a comment:由于我无法添加评论:

To revert the change in your shell, use要恢复 shell 中的更改,请使用

eval $(minikube docker-env -u)

as answered here: How do I undo the command $ eval "$(docker-machine env blog)"在这里回答: 如何撤消命令 $ eval "$(docker-machine env blog)"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM