Docker Community Forums

Share and learn in the Docker community.

CLI to switch between linux and windows images

docker

(Travis Plunk) #1

I can switch between Linux and Windows images using the docker task tray without issue. My question is in regards to the command line. I’ve read and searched the docs but I don’t think I’m looking for the right thing.


(Michael Friis) #2
& $Env:ProgramFiles\Docker\Docker\DockerCli.exe -SwitchDaemon

(Harrisq) #3

Hi,

I am having problems with windowsservercore container image not installing.

Set-up: macOS Sierra with Windows Server 2016 TP5 running inside VirtualBox alongside Docker.

Steps taken:

In advance i have successfully run:

Install-WindowsFeature containers
Enable-WindowsOptionalFeature -Online -FeatureName Containers

I have also downloaded docker and dockerd to C:\Program Files\Docker. These are the only two files in the folder.

I have then run docker pull microsoft/windowsservercore

This resulted in a download and a message saying ‘Unknown blob’. I don’t know where it has downloaded to or what to do with this ‘unknown blob’.

How do i now ensure this is installed as the windowsservercore image for docker to use? I have re-started docker and run docker images which shows no installed images in the repository.

I thought this might be to do with a Linux default being in place to tried running:

& $Env:ProgramFiles\Docker\Docker\DockerCli.exe -SwitchDaemon

Which has resulted in a error message:

& : The term ‘C:\Program Files\docker\DockerCLI.exe’ is not recognised as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again…
ObjectNotFound: (C:\Program Files\docker\DockerCLI.exe:String) [], CommandNotFoundException

I do not have a file called DockerCLI.exe.

Alternatively, i have downloaded the image file ‘WindowsServerCore-10-0-14300-1000.wim’ to C:\Program Files\docker, where i also have the docker and dockerd executables. Can i install this instead? If so, how please?

I do not have a docker icon appearing in my VirtualBox WindowsServer environment so cannot use the switch there.

I have posted a lot about this, for example here StackOverflow post ,and would be grateful for any advice that might help resolve this.


(Harrisq) #4

Hi,

I resolved the issue and added the solution to the StackOverflow post mentioned above.


(Param) #5

Is it possible to specify the container type? say linux or windows. I am scripting this via a build system which deploys both linux and windows containers depending on my project type.


(Jcubed) #6

I took a look at DockerCli, and I’m hoping there’s more interaction possible than what is shown:

$ ./DockerCli.exe
Usage: DockerCli.exe [-SwitchDaemon] [-Version]
-Version: Show the Docker for Windows version information
-SwitchDaemon: Point the Docker CLI to either Linux containers or Windows containers
-SharedDrives: List the shared drives

Is there any way to identify what type of Daemon is currently running, other then by toggling it? Being able to see the other current operating options would be very helpful, too, when gathering info on failures of containers and tools using them.

Only interacting with Docker for Windows via the task tray is very problematic because we need Docker to be running after rebooting its server. Initially, I was doing this with a scheduled task, but that resulted in the task tray icon not being visible for the Administrator. A colleague showed me how to get the Administrator to log-in automatically at start-up, which resolved the missing task tray icon issue but seems like bad practice.


(Nickstrupat) #7

You can control which engine you want to switch to with

-SwitchLinuxEngine
-SwitchWindowsEngine

There’s also these…

-Start
-Stop
-SendDiagnostic
-ResetToDefault
-ResetCredential
-DownloadMobyLogs
-DownloadVpnKitLogs
-MoveVhd
-Mount=
-Unmount=
-Wait=
-SetMemory=
-SetCpus=
-SetDNS=
-SetIP=
-SetDaemonJson=
-SetWindowsDaemonJson=