Docker command line to switch to running linux containers on Windows Core machine

I inherited a Windows Server Core machine, and I want to run linux-based containers in docker on that machine. It is currently set up to run windows-based containers, so I want to switch to running linux containers.

When I try to use a linux-based image, I get this error:

PS C:\Program Files\Docker> docker pull my-linux-based-image
Pulling from my-linux-based-image
image operating system "linux" cannot be used on this platform

On my Windows desktop machine, I'd use the Docker Desktop context menu from the system tray to switch between linux and windows containers, but that's not available in Windows Core. Can I make this switch from the command line?

I see the suggestion to use DockerCli.exe but I don't have this installed, even after making sure I installed the latest docker package. Is there a separate cli-related package I need?

Here's the version info for the docker install on my Windows Core machine:

PS C:\Program Files\Docker> docker version
Client: Docker Engine - Enterprise
 Version:           18.09.8
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        90e30bdf98
 Built:             07/16/2019 17:13:22
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Enterprise
 Engine:
  Version:          18.09.8
  API version:      1.39 (minimum version 1.24)
  Go version:       go1.10.8
  Git commit:       90e30bdf98
  Built:            07/16/2019 17:11:04
  OS/Arch:          windows/amd64
  Experimental:     false

Dockercli -SwitchDaemon option should help here.

$ ./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

You can control which engine you want to switch with using option.

-SwitchLinuxEngine
-SwitchWindowsEngine

More info here.

Hope this helps.

Update:

DockerCli.exe can be found in Program Files folder.

In my case it was here /c/Program\ Files/Docker/Docker/DockerCli.exe

CLI to switch between linux and windows images, 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 am having problems with windowsservercore container image not installing. Set-up:� Docker command line to switch to running linux containers on Windows Core machine. Posted on 17th July 2019 by Chris Farmer

You have to install Docker Enterprise to be able to switch from Windows to Linux containers. See https://computingforgeeks.com/how-to-run-docker-containers-on-windows-server-2019/ for more info.

Run Linux and Windows Containers on Windows 10, With this you can work with Docker running Linux containers in a very With some installation steps you are able to run Windows Hyper-V Containers on your Windows 10 machine. There also is a command line tool to switch the engine. Location Docker.Core.Pipe.NamedPipeServer.RunAction (String� The new –platform=linux command line switch is used to pull or start Linux images on Windows. docker pull --platform=linux ubuntu. Now start the Linux container and a Windows Server Core container. docker run --platform=linux -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done" docker run -d microsoft/windowsservercore ping -t 127.0.0.1. Both containers are running on a single host.

I am using Windows Server 2019 and Docker EE 19.03.11 installed. I have Hyper-v and containers features enabled.

I can't see DockerCli.exe file on my host, so I tried using below command, however its not working and returning me an output of docker help.

C:\Program Files\Docker>docker.exe -SwitchDaemon 

Please suggest how I can switch the docker client to Linux OS/arch

How to Run Linux Containers on Windows Server 2019, It's easy to run containers on Windows 10 but more difficult on a VM of Docker run the below command in an elevated PowerShell window: "1", "Machine") Assuming you've switch to Linux mode, the below should work. Once in the prompt running the below will show us which version of the linux� If you see “Switch to Windows containers…” then you are not currently using Windows containers. Stop any running containers you have and remove all images. You’ll need to switch to Windows containers and the image storage mechanism will change. You won’t be able to manage the images once you switch. Switch to Windows Containers.

Running Docker Windows and Linux Containers Simultaneously , Linux containers were hosted in a Linux Virtual Machine making it With Docker for Windows started and Windows containers selected, The new –platform= linux command line switch is used to pull or start Linux images on Windows. Now start the Linux container and a Windows Server Core container. Install-Module -Name DockerMsftProvider -Force Install-Package -Name docker -ProviderName DockerMsftProvider -Force Restart-Computer -Force. Now the container runs per default as windows container but i want to have it running linux container.

Prep Windows operating system containers, Set up Windows 10 or Windows Server for containers, then move on to NET core application or virtual machine running Windows Server (Semi-Annual Channel), for containers, with a common API and command-line interface (CLI) . To install Docker on Windows Server, you can use a OneGet� I need to use Linux containers for a build. From using Docker for Windows on Windows 10 Pro I knew you can switch the container type in the GUI. Searching for a way to do it via command line lead me to this article, mentioning the follow

Docker not switching to Linux containers on Windows 10 � Issue , Hi, I am running docker for windows on Windows 10 Enterprise edition. It runs When I do right-click on docker icon and "Switch to Linux Container", it keeps on at Docker.Core.Pipe.NamedPipeClient.Send(String action, Object[] Yes the default is Linux at install time, however when host pc reboots to� Switch between Windows and Linux containers. From the Docker Desktop menu, you can toggle which daemon (Linux or Windows) the Docker CLI talks to. Select Switch to Windows containers to use Windows containers, or select Switch to Linux containers to use Linux containers (the default).

Comments
  • bcthomas.com/2019/02/… maybe helpful.
  • Thanks. I don't seem to have DockerCli on this machine. Is that part of a separate docker-related installation?
  • Updated my answer.
  • That exe file still doesn't exist for me.
  • Same here, couldn't find that exe, installed with: 1. Install-Module -Name DockerMsftProvider -Force. 2. Install-Package -Name docker -ProviderName DockerMsftProvider -Force
  • dockercli.exe is installed only with Docker Desktop for Windows. I am running Docker on Windows Server 2019, and did the two ps commands in the previous comment (and restarted the box), and while that's what installed Docker (per the same commands offered at hub.docker.com/editions/enterprise/docker-ee-server-windows), I was left in Windows container mode. So I am seeking the same answer as the OP: how to switch to linux conainer mode, via cmd line, since when Docker is installed this were, there is no status try like with Docker Desktop.
  • It's clunky, but this works. "Running Linux Containers on Windows Server 2019" section shows Install-Package Docker -ProviderName DockerProvider -RequiredVersion preview - that's the key to getting it working (as of today).