Ruby-on-rails Rails,Docker:主机不存在:“默认”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34785064/
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-03 00:21:26  来源:igfitidea点击:

Rails, Docker: Host does not exist: "default"

ruby-on-railsdocker

提问by VPaskar

When I try to run docker-machine start default, I get Host does not exist: "default", I tried eval "$(docker-machine env default)", but still getting the same message. Where is the error ?

当我尝试运行时docker-machine start default,我得到了Host does not exist: "default",我尝试了eval "$(docker-machine env default)",但仍然收到相同的消息。错误在哪里?

回答by VonC

Try simply to check what machine has been created (docker-machine ls):

尝试简单地检查已创建的机器 ( docker-machine ls):

docker-machine ls

Then you can pick one and try your commands with it.

然后你可以选择一个并用它来尝试你的命令。

If there is none, you can create one first (docker-machine create).
In the case of the OP:

如果没有,您可以先创建一个 ( docker-machine create)。
在 OP 的情况下:

docker-machine create default

Since the error message was:

由于错误消息是:

Cannot connect to the Docker daemon. Is the docker daemon running on this host?

无法连接到 Docker 守护程序。docker 守护进程是否在这台主机上运行?

One of the answers of "Docker command can't connect to docker daemon" should work:

Docker command can't connect to docker daemon”的答案之一应该有效:

sudo service docker restart

回答by Dai Kaixian

you may try:

你可以尝试:

docker-machine create -d virtualbox default

UPDATE 2016/10/19

更新 2016/10/19

The old answer may only work on mac with virtualbox installed.

旧答案可能仅适用于安装了 virtualbox 的 mac。

If you are running docker-machine on windows, you should use Hyper-V :

如果你在 Windows 上运行 docker-machine,你应该使用 Hyper-V :

docker-machine create --driver hyperv vm

see detail here:https://docs.docker.com/machine/drivers/hyper-v/

在此处查看详细信息:https: //docs.docker.com/machine/drivers/hyper-v/

And if you are using Docker Machine to provision hosts on cloud providers, you may need other driver such as amazonec2 . More detail:https://docs.docker.com/machine/get-started-cloud/

如果您使用 Docker Machine 在云提供商上配置主机,您可能需要其他驱动程序,例如 amazonec2 。更多细节:https: //docs.docker.com/machine/get-started-cloud/

回答by Harrison Kamau

Sometimes, docker-machine start defaultmight misbehave and require you to rerun the command again. In that case, running eval "$(docker-machine env default)"will bring back joy :)

有时,docker-machine start default可能会出现错误行为并要求您再次重新运行该命令。在那种情况下,跑步eval "$(docker-machine env default)"会带来快乐:)

回答by LihO

In case you run

如果你跑

docker-machine ls

and it lists defaultbut running docker-machine kill defaultand docker-machine stop defaultboth complain that it doesn't exist, try to remove it completely and setup again:

它列出default但正在运行docker-machine kill default并且docker-machine stop default都抱怨它不存在,尝试完全删除它并重新设置:

docker-machine rm default
docker-machine create default

(had this weird issue on Windows with virtualbox)

(在带有 virtualbox 的 Windows 上有这个奇怪的问题)