[英]Connect to Windows 10 Docker daemon from Ubuntu Bash
I'm trying to do something fairly non-standard, so I'm not sure how successful I'm going to be. 我正在尝试做一些相当不规范的事情,所以我不确定自己会有多成功。
I've installed "Docker for Windows", and I'm able to use it fine from PowerShell. 我已经安装了“Docker for Windows”,我可以在PowerShell中使用它。
I would like to be able to use a proper Linux environment though, so I've installed the new Ubuntu Bash prompt for Windows 10. 我希望能够使用适当的Linux环境,所以我已经为Windows 10安装了新的Ubuntu Bash提示符。
I've successfully built the latest Docker client in Ubuntu/Bash. 我已经在Ubuntu / Bash中成功构建了最新的Docker客户端。 However when I run "docker ps", I get:
但是当我运行“docker ps”时,我得到:
Cannot connect to the Docker daemon.
无法连接到Docker守护程序。 Is the Docker daemon running on this host?
Docker守护程序是否在此主机上运行?
I had hoped that it might just work. 我曾希望它可能会起作用。
Is it possible to connect to a Docker daemon running in Windows from Ubuntu/Bash? 是否可以从Ubuntu / Bash连接到Windows中运行的Docker守护程序?
I figured it out. 我想到了。 It was surprisingly simple.
这简直太简单了。 I just had to set the following...
我只需设置以下内容......
export DOCKER_HOST=tcp://127.0.0.1:2375
This is actually a really cool setup. 这实际上是一个非常酷的设置。
A very fast, efficient Docker engine running in a type 2 hypervisor, and a proper Ubuntu-based development environment. 在2型虚拟机管理程序中运行的非常快速,高效的Docker引擎,以及适当的基于Ubuntu的开发环境。 Nice :-)
尼斯:-)
Notice: as @BSalita mentioned in the comment, the Docker service must be running with "Expose daemon on tcp://localhost:2375 without TLS" enabled, which can be found in the general section in Docker Settings (right click on the system tray icon then "Settings..."). 注意:正如注释中提到的@BSalita一样,Docker服务必须在“启用tcp:// localhost:2375而不使用TLS”的“Expose守护程序”上运行,这可以在Docker Settings的常规部分找到(右键单击系统)托盘图标然后“设置...”)。 This option is not checked by default.
默认情况下不会选中此选项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.