windows docker-machine:没有机器名,没有“默认”存在

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39966083/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 19:41:37  来源:igfitidea点击:

docker-machine: no machine name, no "default" exists

windowsdockerboot2dockerhyper-vdocker-machine

提问by Jim

I downloaded and installed Docker for Windows 1.12.1 which in turn installed the docker-machine and docker-compose. I did not install "Docker Toolbox" since its a duplicate of what was installed and my system meets the requirements.

我下载并安装了 Docker for Windows 1.12.1,它依次安装了 docker-machine 和 docker-compose。我没有安装“Docker Toolbox”,因为它与安装的内容重复并且我的系统满足要求

Everything seems to work fine except for docker-machine, I'm running through a tutorial and when I run various docker-machine commands like "ip" or "env" I get the following message.

除了 docker-machine 之外,一切似乎都正常,我正在学习教程,当我运行各种 docker-machine 命令(如“ip”或“env”)时,我收到以下消息。

Error: No machine name(s) specified and no "default" machine exists.

So when I do a "docker-machine ls" there is nothing in the list even though I do have a Hyper-V docker machine installed and docker commands work fine.

因此,当我执行“docker-machine ls”时,即使我安装了 Hyper-V docker 机器并且 docker 命令工作正常,列表中也没有任何内容。

C:\tmp>docker-machine ls
NAME   ACTIVE   DRIVER   STATE   URL   SWARM   DOCKER   ERRORS
C:\tmp>

Am I missing something here? Did I miss something in the documentation? If so can someone please point me in the right direction to fix this?

我在这里错过了什么吗?我错过了文档中的某些内容吗?如果是这样,有人可以指出我正确的方向来解决这个问题吗?

Thanks for any help,

谢谢你的帮助,

Jim

吉姆

回答by Windsooon

Docker Machine is a tool that lets you install Docker Engine on virtual hosts

Docker Machine 是一个可以让你在虚拟主机上安装 Docker Engine 的工具

Docker machine just like building docker on a Vm, so first you have to create a Vm, in your case:

Docker 机器就像在 Vm 上构建 docker 一样,所以首先你必须创建一个 Vm,在你的情况下:

docker-machine create default

回答by Carlos Rafael Ramirez

You don't need docker-machineto manage the Hyper-V virtual machine. In fact you can't unless you configure it explicitly to do so. If you want to see your IP use the Docker for Windows GUI.

您不需要docker-machine管理 Hyper-V 虚拟机。事实上,除非您明确配置它以这样做,否则您不能这样做。如果您想查看您的 IP,请使用 Docker for Windows GUI。

The Docker team wants you to use Docker for Windows like a regular Docker in Linux and not have to bother with virtual machine stuff.

Docker 团队希望您像在 Linux 中使用常规 Docker 一样在 Windows 上使用 Docker,而不必为虚拟机的东西而烦恼。

Docker-machineis included in the same way you can install in Linux. It is for managing machines in the cloud for example, or accessing a remote Docker Engine. For example in Linux you issue your Docker commands in a natural way, but you can also have a virtual machine with Docker and manage it using docker-machinein your host. Now in Windows it works in the same way.

Docker-machine包含在与在 Linux 中安装相同的方式中。例如,它用于管理云中的机器,或访问远程 Docker 引擎。例如,在 Linux 中,您以自然的方式发出 Docker 命令,但您也可以拥有一个带有 Docker 的虚拟机并docker-machine在您的主机中使用它进行管理。现在在 Windows 中它以相同的方式工作。

Regards

问候

回答by Harold Castillo

Documentation docker-machine create

文档docker-machine 创建

docker-machine create --driver virtualbox dev

or

或者

docker-machine create -d virtualbox \
    --engine-label foo=bar \
    --engine-label spam=eggs \
    --engine-storage-driver overlay \
    --engine-insecure-registry registry.myco.com \
    foobarmachine

回答by Basil Musa

Two steps to find the IP address of the Hypervisor machine:

查找 Hypervisor 机器的 IP 地址的两个步骤:

Step #1: Open Hyper-Visor Manageron Windows, then select the "MobyLinuxVM" virtual machine.

第 1 步:在 Windows 上打开Hyper-Visor Manager,然后选择“MobyLinuxVM”虚拟机。

Step #2: On the bottom middle of the Hyper-V Managerthere is a small tab labelled "Networking", click it.

第 2 步:在Hyper-V 管理器的底部中间有一个标有“网络”的小标签,单击它。

Step #3: Take note of the MAC Address.

第 3 步:记下 MAC 地址。

Step #4: Open a command prompt and write ipconfig /allto figure out the IP address for this mac address.

第 4 步:打开命令提示符并写入ipconfig /all以找出此 mac 地址的 IP 地址。

If anyone finds a simpler way to do this please let me know.

如果有人找到更简单的方法来做到这一点,请告诉我。

回答by Tim Long

All other answers didn't help, until I restart the machine! It could also mean, some of the command have done or created something. And the restart has just finalised those.

所有其他答案都没有帮助,直到我重新启动机器!这也可能意味着,某些命令已经完成或创建了一些东西。而重启刚刚完成了这些。

回答by enderland

You need to create the machine.

您需要创建机器。

docker-machine create

or

或者

docker-machine create mymachinename