如何在 windows 应用程序的 ubuntu 中 运行 docker?

How do I run docker inside the ubuntu on windows app?

我希望能够在运行docker里面ubuntu on widnows app。但是安装 docker 工具箱后,出现以下错误:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

有人以前见过这个错误吗?我在 windows 上直接 运行ning docker 会更好吗?

您的 Docker 客户端不知道您的 Docker 主机(详尽解释 here)。

You need to tell the Docker client where the Docker host is, and you can do that by using the -H option:

$ docker -H localhost:2375 some docker command

如果你不想每次都输入主机,你可以设置环境变量DOCKER_HOSTlocalhost:2375

$ export DOCKER_HOST=localhost:2375

但是,该环境变量的持续时间与会话的持续时间一样长。每次打开 bash 时都必须设置它。因此,为了避免这种情况,您将该变量设置在主目录中名为 .bash_profile 的文件中,如下所示:

$ echo “export DOCKER_HOST=localhost:2375” >> ~/.bash_profile

还要确保在 Windows 上公开守护程序,您可以在 Docker 的 Windows 的 Settings 菜单(选项卡“常规”)中实现。

重新启动 bash 控制台,DOCKER_HOST 变量应该在那里,只需键入 e。 G。 docker images 检查所有内容。