Docker Community Forums

Share and learn in the Docker community.

Linux container in w2k16


(Illera88) #1

Hi,

I’m successfully created a windows and linux container in windows 10 using Docker beta to change between linux and windows mode.

How can I do the same with Windows Server 2016? I can create windows containers but I don’t know how to change to linux mode to create a Linux container.

Thank you


Linux container on Windows Server 2016
Linux container on Windows Server 2016
(Algore) #2

Yeah it is possible and the hipsters here won’t tell you how to do it. There is no documentation for this anywhere because they won’t simply remove the error message for the beta installer on server 2016. They probably just don’t want to give it away for Friis and it will be a paid product. Just so you know, running an application container will simply create a Linux VM (MobyLinux) and essentially run the container under it so it is pretty inefficient for large programs. Anyways, here is how you do it:

Download the Docker beta installer: https://docs.docker.com/docker-for-windows/

Install Docker beta on a Windows 10 Pro + machine or VM. If you don’t have one, just download the Enterprise trial iso from the Microsoft eval center.

copy C:\program files\Docker from the Windows 10 machine to C:\program files on your Server 2016 box

on the server 2016 box, run install-windowsfeature hyper-v,containers

copy these registry entries to a file and import them on your Server 2016 box (reg import):

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Docker Inc.]

[HKEY_LOCAL_MACHINE\SOFTWARE\Docker Inc.\Docker]

[HKEY_LOCAL_MACHINE\SOFTWARE\Docker Inc.\Docker\1.0]
“AppPath”="“C:\Program Files\Docker\Docker\Docker for Windows.exe”"
“BinPath”="“C:\Program Files\Docker\Docker\resources\bin”"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application\DockerService]
“EventMessageFile”=hex(2):43,00,3a,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,77,
00,73,00,5c,00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,2e,00,
4e,00,45,00,54,00,5c,00,46,00,72,00,61,00,6d,00,65,00,77,00,6f,00,72,00,6b,
00,36,00,34,00,5c,00,76,00,34,00,2e,00,30,00,2e,00,33,00,30,00,33,00,31,00,
39,00,5c,00,45,00,76,00,65,00,6e,00,74,00,4c,00,6f,00,67,00,4d,00,65,00,73,
00,73,00,61,00,67,00,65,00,73,00,2e,00,64,00,6c,00,6c,00,00,00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\com.docker.service]
“Type”=dword:00000010
"Start"=dword:00000002
"ErrorControl"=dword:00000000
"ImagePath"=hex(2):22,00,43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,
6d,00,20,00,46,00,69,00,6c,00,65,00,73,00,5c,00,44,00,6f,00,63,00,6b,00,65,
00,72,00,5c,00,44,00,6f,00,63,00,6b,00,65,00,72,00,5c,00,63,00,6f,00,6d,00,
2e,00,64,00,6f,00,63,00,6b,00,65,00,72,00,2e,00,73,00,65,00,72,00,76,00,69,
00,63,00,65,00,22,00,00,00
"DisplayName"=“Docker for Windows Service”
“ObjectName”=“LocalSystem”
“Description”=“Run Docker for Windows backend service”

you can add an entry to currentversion\run or a scheduled job if you want docker for windows.exe to start up automatically

restart the computer and run the ps1 script C:\program files\docker\docker\resources\mobylinuxvm.ps1 -create
look into this ps1 file and notice that you can set various options. Please refer to these websites:

http://docker-saigon.github.io/post/Docker-Beta/
http://jpetazzo.github.io/2013/10/16/configure-docker-bridge-network/

Make sure the docker service com.docker.service (start-service com.docker.service) is running before you start c:\program files\docker\docker for windows.exe

if you are running on server core and don’t have the tray icon, click “change privacy settings” when the notification comes up after it starts to get to settings (or modify the json in programdata)

If you run into issues when trying things and rebuilding, check out the C:\program files\docker\docker\resources\forceremovedocker.ps1 file for locations to delete settings such as in c:\programdata. I would advise against running the script as it deletes all docker related things. Just use pieces of it.


(Illera88) #3

Nobody know about this?

Cheers


(Illera88) #4

Cool, How is that there is not a no hacky way to achieve this?

Thanks!!


(Hougie) #5

@algore Thanks!!! Your procedure worked like a charm.


(Allenu) #6

I see that part of the instructions is to install hyper-v. So I’m assuming this particular method will only work on bare-metal and not in a VM? @algore can you confirm this to be the case? Thank you for your detailed post btw.


(Linus) #7

This thread is a bit old but kept showing up when I search for Linux Container running on Windows Host.

Now, it is possible to install Docker on Windows Server 2016 (bare-metal or VM) to run Linux Containers.

  • Install Windows Server 2016 (I can only get it to work with Desktop Experience).
  • Make sure that Virtualization is supported. On my VMWare Workstation, I enabled “Virtualize Intel VT-x/EPT or AMD-V/RVI” in the Processors settings.
  • Download Docker installer from https://store.docker.com/editions/community/docker-ce-desktop-windows (The “Edge (Windows Server 2016)” version)
  • Enable Hyper-V role for Windows Server 2016
  • Install Docker

(Kumarunv) #8

HI , Is there an update to run Linux containers on Win server 2016 , or still Beta
appreciate any assistance on this topic


#9

Also chewing in here - what option do we currently have to simply run Linux containers on Windows Server 2016 the way we do this in Windows 10? I’m not talking about LCOW which will probably take a couple more months to be finished (@friism ?), but just do the MobyLinux VM on Hyper-V and run linux containers inside there. The following absolutely makes no mention of this:
https://store.docker.com/editions/enterprise/docker-ee-server-windows