如何在 OSX 上启动 docker-机器?

How to start docker-machine on OSX?

我昨天第一次安装并使用了docker,

一切正常,但昨天晚上我关闭了计算机。

今天我启动了它,我想开发我的 docker 应用程序,但是当我尝试 运行 它就像

docker run -d -p 8080:8080 container/app

我收到错误:

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

但是我找不到如何再次启动docker...

想法?

编辑:

eval "$(docker-machine env default)"

结果:

Error checking TLS connection: Host is not running

如果 "default" 机器不是 运行ning,docker-machine env default 命令将不起作用。

您可以 运行 docker-machine ls 命令,它会为您提供已配置的机器列表及其当前状态(运行ning,已停止)。

如果机器停止,运行 docker-machine start <name-of-machine>。之后你应该可以使用

设置环境变量
eval "$(docker-machine env default)"

请阅读 https://docs.docker.com/machine/overview 上的文档了解更多详情

在我 运行 命令 $ docker-machine start default 之后,我收到

的消息
Starting "default"...
(default) Check network to re-create if needed...
(default) Creating a new host-only adapter produced an error: /usr/local/bin/VBoxManage hostonlyif create failed:
(default) 0%...
(default) Progress state: NS_ERROR_FAILURE
(default) VBoxManage: error: Failed to create the host-only adapter
(default) VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
(default) VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
(default) VBoxManage: error: Context: "RTEXITCODE handleCreate(HandlerArg *)" at line 94 of file VBoxManageHostonly.cpp
(default) 
(default) This is a known VirtualBox bug. Let's try to recover anyway...
Error setting up host only network on machine start: The host-only adapter we just created is not visible. This is a well known VirtualBox bug. You might want to uninstall it and reinstall at least version 5.0.12 that is supposed to fix this issue

文末提供解决方案,

This is a known VirtualBox bug. Let's try to recover anyway...
Error setting up host only network on machine start: The host-only adapter we just created is not visible. This is a well known VirtualBox bug. You might want to uninstall it and reinstall at least version 5.0.12 that is supposed to fix this issue

我卸载了然后,尝试重新安装VirtualBox。还是一样。

然后,我在机器的任何位置允许应用程序,这解决了问题:

允许来自任何地方的应用程序:sudo spctl --master-disable