# Feature detect Docker for Windows?

**URL:** <https://forums.docker.com/t/feature-detect-docker-for-windows/21622>\
**Category:** Docker Desktop\
**Tags:** windows\
**Created:** [September 6, 2016, 6:26am UTC](https://forums.docker.com/t/feature-detect-docker-for-windows/21622 "2016-09-06T06:26:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![provegard](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/provegard/32/11480_2.png) [@provegard](https://forums.docker.com/u/provegard)\
**Post date:** [September 6, 2016, 6:26am UTC](https://forums.docker.com/t/feature-detect-docker-for-windows/21622/1 "2016-09-06T06:26:32Z")

</div>

How do you detect that Docker for Windows is running, as opposed to boot2docker or Docker Machine?

On Mac, I test the presence of a `/var/run/docker.sock` socket. But on Windows?

My ideas so far are:

- grep the output of `docker info` and test that the name is “moby”
- test connectivity to the Docker Engine API on localhost:2375

But I’m unsure if these could give false positives, especially the name test.

Ideas?

---

<div class="post-metadata">

**Author:** ![friism](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/friism/32/3570_2.png) [@friism](https://forums.docker.com/u/friism)\
**Post date:** [September 6, 2016, 11:17am UTC](https://forums.docker.com/t/feature-detect-docker-for-windows/21622/2 "2016-09-06T11:17:02Z")

</div>

What about checking for the named pipe or sending a request there? Details here: [https://docs.docker.com/docker-for-windows/faqs/#/how-do-i-connect-to-the-remote-docker-engine-api](https://docs.docker.com/docker-for-windows/faqs/#/how-do-i-connect-to-the-remote-docker-engine-api)

---

<div class="post-metadata">

**Author:** ![provegard](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/provegard/32/11480_2.png) [@provegard](https://forums.docker.com/u/provegard)\
**Post date:** [September 6, 2016, 5:28pm UTC](https://forums.docker.com/t/feature-detect-docker-for-windows/21622/3 "2016-09-06T17:28:08Z")

</div>

Connecting to the named pipe doesn’t work for me. This PowerShell snippet:

```
$pipe = new-object System.IO.Pipes.NamedPipeClientStream("\\.\pipe\docker_engine")
$pipe.Connect()

```

…just hangs. Using `npipe:////./pipe/docker_engine` as the FAQ suggests gives me an error about incorrect format.

Process Explorer doesn’t find any named pipe with “docker\_engine” in the name.

However, connecting to [http://localhost:2375](http://localhost:2375) works. Maybe that’s the best approach after all.

---

<div class="post-metadata">

**Author:** ![friism](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/friism/32/3570_2.png) [@friism](https://forums.docker.com/u/friism)\
**Post date:** [September 8, 2016, 2:54pm UTC](https://forums.docker.com/t/feature-detect-docker-for-windows/21622/4 "2016-09-08T14:54:23Z")

</div>

The pipe is there when Docker for Windows is running:

```auto
docker -H npipe:////./pipe/docker_engine version
Client:
 Version: 1.12.1
 API version: 1.24
 Go version: go1.6.3
 Git commit: 23cf638
 Built: Thu Aug 18 17:32:24 2016
 OS/Arch: windows/amd64
 Experimental: true

Server:
 Version: 1.12.1
 API version: 1.24
 Go version: go1.6.3
 Git commit: 23cf638
 Built: Thu Aug 18 17:32:24 2016
 OS/Arch: linux/amd64
 Experimental: true

```

```auto
[System.IO.Directory]::GetFiles("\\.\\pipe\\") | Select-String -pattern "docker"

\\.\\pipe\\PSHost.131176286632409278.26752.DefaultAppDomain.com.docker.service
\\.\\pipe\\dockerBackend
\\.\\pipe\\dockerLogs
\\.\\pipe\\PSHost.131178195006249300.8044.DefaultAppDomain.Docker for Windows
\\.\\pipe\\dockerDataBase
\\.\\pipe\\dockerMobyLinuxVM-com1
\\.\\pipe\\docker_engine

```

---

<div class="post-metadata">

**Author:** ![provegard](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/provegard/32/11480_2.png) [@provegard](https://forums.docker.com/u/provegard)\
**Post date:** [September 8, 2016, 5:52pm UTC](https://forums.docker.com/t/feature-detect-docker-for-windows/21622/5 "2016-09-08T17:52:47Z")

</div>

The first command works!

(The second doesn’t, I get “Second path fragment must not be a drive or UNC name” - but it doesn’t matter.)

Thanks!
