Linux and Windows Images Side by Side

I currently have Docker for Windows 1.12.0 using the Linux server. I would like to try the new Windows Images (windows server core/nano), but does that mean that I need to uninstall the current Linux version to use the Windows version?

Can they run side by side?

Thanks!
-Eduardo

2 Likes

You can run them side-by-side. When installing the Windows engine, register it on different pipe name:

.\dockerd.exe -H npipe:////./pipe/win_engine --register-service

Then you can use the Windows engine like this:

docker -H npipe:////./pipe/win_engine pull microsoft/nanoserver

… or set $Env:DOCKER_HOST.

(Or you can just stop Docker for Windows before starting the Windows Docker Engine)

2 Likes

I think that would be great to have a proper documentation about this.

But, to start with, I am not too sure to understand fully.
At which point of the install should we run?
.\dockerd.exe -H npipe:////./pipe/win_engine --register-service

Also every time you want to use the Windows images we would have to use the -H option? That seems super annoying.
Any plan to get around this by being able to set some alias?

docker -h win pull microsoft/nanoserver

Looking at the Docker install section, you’d do this in an elevated prompt (all same as in MS doc):

Invoke-WebRequest "https://get.docker.com/builds/Windows/x86_64/docker-1.12.0.zip" -OutFile "$env:TEMP\docker-1.12.0.zip" -UseBasicParsing
Expand-Archive -Path "$env:TEMP\docker-1.12.0.zip" -DestinationPath $env:ProgramFiles
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$env:ProgramFiles\docker\", [EnvironmentVariableTarget]::Machine)

The next line is slightly different:

& $env:ProgramFiles\docker\dockerd.exe  -H npipe:////./pipe/win_engine --register-service

Or if you want to use the engine from a non-elevated prompt, you can register it like this:

& $env:ProgramFiles\docker\dockerd.exe  -H npipe:////./pipe/win_engine -G <your-windows-username> --register-service

And then (same as doc):

Start-Service Docker

From then on, to use the Docker engine, you can either use -H with every Docker command:

> docker -H npipe:////./pipe/win_engine version
Client:
 Version:      1.12.1-rc1
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   7889dc7
 Built:        Fri Aug 12 18:35:53 2016
 OS/Arch:      windows/amd64
 Experimental: true

Server:
 Version:      1.13.0-dev
 API version:  1.25
 Go version:   go1.6.3
 Git commit:   402cf23
 Built:        Thu Aug  4 08:44:34 2016
 OS/Arch:      windows/amd64

Or if you don’t want to do that, set the DOCKER_HOST environment variable:

> $Env:DOCKER_HOST = "npipe:////./pipe/win_engine"
> docker version
Client:
 Version:      1.12.1-rc1
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   7889dc7
 Built:        Fri Aug 12 18:35:53 2016
 OS/Arch:      windows/amd64
 Experimental: true

Server:
 Version:      1.13.0-dev
 API version:  1.25
 Go version:   go1.6.3
 Git commit:   402cf23
 Built:        Thu Aug  4 08:44:34 2016
 OS/Arch:      windows/amd64
4 Likes

Thank you @friism this is exactly what I was looking for :slight_smile:, although I agree that there should be an easier way of doing this

We agree too and are working on it :slight_smile:

2 Likes

I try:

C:\Users\mikeb
λ “%programfiles%\Docker\Docker\Resources\dockerd.exe” -H npipe:////./pipe/win_engine --debug --experimental
time=“2017-06-06T23:04:27-04:00” level=warning msg=“Running experimental build”
Error starting daemon: pid file found, ensure docker is not running or delete C:\ProgramData\docker\docker.pid

So I need 2 dockerd installation with different pid, root, domain socket, … That’s really become complicate.

I can switch of environment, like that:

C:\Users\mikeb
λ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e942a51f07e7 centos “bash” 16 seconds ago Up 15 seconds nifty_mirzakhani

C:\Users\mikeb
λ “c:\Program Files\Docker\Docker\DockerCli.exe” -SwitchDaemon & docker -D info -f {{.OSType}}
windows

C:\Users\mikeb
λ docker run -dit microsoft/nanoserver
1704dbe7d8409a5140ab3dfd859569167ee362222d4b18335046aa50e3196663

C:\Users\mikeb
λ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1704dbe7d840 microsoft/nanoserver “c:\windows\system…” 11 seconds ago Up 7 seconds gracious_thompson

C:\Users\mikeb
λ “c:\Program Files\Docker\Docker\DockerCli.exe” -SwitchDaemon & docker -D info -f {{.OSType}}
linux

C:\Users\mikeb
λ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e942a51f07e7 centos “bash” About a minute ago Up About a minute nifty_mirzakhani

But the problem, you cannot switch daemon when docker is executing a command ( like dock pull) because the command will be aborted. Also the first switch is really slow.