Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

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.

I've successfully built the latest Docker client in Ubuntu/Bash. However when I run "docker ps", I get:

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

I had hoped that it might just work.

Is it possible to connect to a Docker daemon running in Windows from Ubuntu/Bash?

like image 413
user1751825 Avatar asked Aug 05 '16 06:08

user1751825


People also ask

How do I access Docker Daemon?

On MacOS go to the whale in the taskbar > Preferences > Daemon > Advanced. You can also start the Docker daemon manually and configure it using flags. This can be useful for troubleshooting problems. Many specific configuration options are discussed throughout the Docker documentation.


1 Answers

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. 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..."). This option is not checked by default.

like image 66
user1751825 Avatar answered Oct 05 '22 16:10

user1751825