Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker Linux containers on Windows Server (LCOW) and Service Fabric Example #2

Open
MedAnd opened this issue Jun 17, 2017 · 28 comments

Comments

@MedAnd
Copy link

MedAnd commented Jun 17, 2017

Hi @vturecek @msfussell any update/ETA on when Service Fabric will support Docker Linux containers on Windows 10 / Windows Server 2016?

@MedAnd MedAnd changed the title Docker containers on Windows Example Docker Linux containers on Windows Example Jun 17, 2017
@msfussell
Copy link
Contributor

Service Fabric supports containers on Windows Server 2016 with the current v5.6 release. You can run this in production, it is fully supported.

It is not supported on Windows 10 yet and hence for local debugging in a Service Fabric project, that is coming in the forthcoming release. For local debugging right now you have to use the ASP.NET core project type and add Docker support or debug Service Fabric as a process.

@MedAnd
Copy link
Author

MedAnd commented Jun 18, 2017

@msfussell I've updated the title to better reflect an example of Docker Linux containers running on Windows Server 2016 and Service Fabric. Seems this is still not a supported scenario.

@MedAnd MedAnd changed the title Docker Linux containers on Windows Example Docker Linux containers on Windows Server 2016 and Service Fabric Jun 30, 2017
@MedAnd MedAnd changed the title Docker Linux containers on Windows Server 2016 and Service Fabric Docker Linux containers on Windows Server 2016 and Service Fabric Example Jun 30, 2017
@MedAnd
Copy link
Author

MedAnd commented Jul 16, 2017

Hi @msfussell @RajeetN

I installed Docker CE (edge release) on Windows Server 2016 with latest Service Fabric + VS 2017. I pulled a Linux Container & created a Service Fabric container project following guidance. Upon publishing the project (SomeLinuxContainer) I see the following error in Service Fabric:

Error event: SourceId='System.Hosting', Property='Download:1.0:1.0'.
There was an error during download.Failed to download container image SomeLinuxContainer

Just want to triple check the above is not currently supported or should I raise a bug in the service-fabric-issues?

Thx.

@msfussell
Copy link
Contributor

msfussell commented Jul 16, 2017 via email

@MedAnd MedAnd closed this as completed Jul 17, 2017
@sfmskywalker
Copy link

@msfussell
Copy link
Contributor

@sfmskywalker Yes, with the advent of Linux images in containers you will now be able to do this with the Windows 1709 build, which has just become available.

@sfmskywalker
Copy link

Awesome!

@julioas09
Copy link

Hi, have any of you tried to use Linux and Windows containers simultaneously on windows hosts using Service Fabric? Is this supported after Windows Server 1709?

@RajeetN
Copy link

RajeetN commented Mar 23, 2018

No Service Fabric does not support Linux containers on windows today. We are working on enabling this for a future release

@pksorensen
Copy link

I just used a few hours going over

https://www.thomasmaurer.ch/2017/10/how-to-run-docker-linux-container-on-windows-server-1709/
https://cloudblogs.microsoft.com/windowsserver/2017/09/13/sneak-peek-3-windows-server-version-1709-for-developers/

and playing with windows 1709.

But i found no way to get the dockerd to work with unix images. More specific I run into issues when trying to restart the docker service after installing the preview docker and having enabled container features. So my conclussion is that its not possible at this point to get it working

@chunliu
Copy link

chunliu commented May 23, 2018

lcow can be configured on a SF cluster nodes with Windows 1709. However, to pull or run a Linux container on Windows, --platform linux is required. It seems there is no way in the current version of SF to pass this parameter on to docker.

@cpersso9
Copy link

@chunli Apparently there is a way to pass parameters on to docker, but you will have to update the Service Fabric manifest... Haven't tried it out though.

https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-get-started-containers#start-the-docker-daemon-with-custom-arguments

@chunliu
Copy link

chunliu commented Sep 15, 2018

@cpersso9 Parameter ContainerServiceArguments is for passing arguments to docker daemon. However, to run a Linux container on Windows, you will need to run the container with the command docker run --platform linux .... Currently, there is no way to instruct SF to launch a container with this parameter.

@pksorensen
Copy link

@chunliu maybe this is an option for you, to set it for default platform linux?

It can be done with environment variable LCOW_API_PLATFORM_IF_OMITTED linux

Dont know yet how to set this before SF cluster starts its daemon.

@MedAnd
Copy link
Author

MedAnd commented Sep 15, 2018

Wondering what everyone thinks, should we re-open this issue or maybe create a new one on https://github.com/Azure/service-fabric-issues ?

cc @raunakpandya

@pksorensen
Copy link

@chunliu What is your experience with enabling lcow on sf cluster? How easily can it be done? Whats the steps?

@chunliu
Copy link

chunliu commented Sep 16, 2018

@pksorensen Enabling lcow on sf cluster is quite easy. You can do the following.

When you provision the sf cluster with an ARM template, you can use a powershell script to configure the docker daemon. See my blog post regarding the ARM template: Deploying a Service Fabric cluster to run Windows containers. And I have a gist that can be used as the PowerShell script to enable lcow. config-lcow.ps1. You can extend the script to support environment variables.

But even if you can run linux containers with the env variable LCOW_API_PLATFORM_IF_OMITTED, you will lose the capability of running Windows containers. To get a sf cluster supporting both Windows and Linux containers, I guess we need to wait for sf team's official support.

@pksorensen
Copy link

I agree @chunliu - i just had a use case where i only needed linux containers.

And in the past i was using SkipDockerProcessManagement and setting up my own deamon. But i will look at your posts and maybe it can update this approach :)

@pksorensen
Copy link

My install script looks like this:

#
# MyCustomScriptExtension.ps1
#
param (
  $vmAdminUsername,
  $vmAdminPassword
)
 
$password =  ConvertTo-SecureString $vmAdminPassword -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential("$env:USERDOMAIN\$vmAdminUsername", $password)
 
Write-Verbose -Verbose "Entering Custom Script Extension..."
 
Invoke-Command -Credential $credential -ComputerName $env:COMPUTERNAME -ArgumentList $PSScriptRoot -ScriptBlock {
  param 
  (
    $workingDir
  )
 
  #################################
  # Elevated custom scripts go here 
  #################################
  Write-Verbose -Verbose "Entering Elevated Custom Script Commands..."

stop-service docker
& "C:/Program Files/Docker/dockerd.exe" --unregister-service
stop-process -name dockerd -Force  -ErrorAction SilentlyContinue
rm "C:/Program Files/Docker/docker.exe" -Force
rm "C:/Program Files/Docker/dockerd.exe" -Force
rm "C:/Program Files/Docker/metadata.json" -Force
[Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", "1", "Machine")
[Environment]::SetEnvironmentVariable("LCOW_API_PLATFORM_IF_OMITTED", "linux", "Machine")
Install-Module DockerProvider -Force
Install-Package Docker -ProviderName DockerProvider -RequiredVersion preview -Force
mkdir d:/docker
$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False
[System.IO.File]::WriteAllLines("$env:programdata/docker/config/daemon.json", '{"graph":"d:/docker"}', $Utf8NoBomEncoding)
restart-service docker

}


From your script i am concluding that you also update "$Env:ProgramFiles\Docker" - it was my impression that service fabric used a different daemon.

@MedAnd
Copy link
Author

MedAnd commented Sep 16, 2018

@msfussell @RajeetN - hope someone from the team can clarify when LCOW will be fully enabled & supported, seems a few of us would really find this useful ☺️

@MedAnd MedAnd changed the title Docker Linux containers on Windows Server 2016 and Service Fabric Example Docker Linux containers on Windows Server (LCOW) and Service Fabric Example Sep 16, 2018
@MedAnd MedAnd reopened this Sep 16, 2018
@pksorensen
Copy link

Looks like the environment variable was removed later also.

moby/moby@c111fec#diff-f0ccc740f5a5ed38075be6855298809cL83

@javierfigueroa
Copy link

javierfigueroa commented Nov 4, 2018

@cpersso9 Parameter ContainerServiceArguments is for passing arguments to docker daemon. However, to run a Linux container on Windows, you will need to run the container with the command docker run --platform linux .... Currently, there is no way to instruct SF to launch a container with this parameter.

Could I use the <Commands /> node under . <ContainerHost /> to pass "--platform linux" ?
e.g. <Commands>--platform linux</Commands>

@MedAnd
Copy link
Author

MedAnd commented Mar 26, 2019

Hi @masnider @mikkelhegn @raunakpandya - any update on this feature? Client is interested in amalgamating workloads which require a separate Linux based Kubernetes cluster for machine learning...

For a little more background, I'm proto-typing the idea locally using Windows Server 2019 which I know is currently undergoing Service Fabric compatibility testing. Thx.

Related:

@darraghjones
Copy link

I'm trying to run a Linux container on Service Fabric on Windows 10, and I'm getting the following error:

'System.Hosting' reported Error for property 'Download:1.0:1.0:fea71a9d-fba6-40fc-8db5-5aaf29fe4346'.
There was an error during download. Container deployment is not supported on the node.

I can't quite figure out if running Linux containers is supposed to work?
Note that I can run Linux containers in Windows 10 without Service Fabric just fine.

@MedAnd
Copy link
Author

MedAnd commented Jul 30, 2019

I do not think LCOW is supported by Service Fabric yet, but this feature request may also be of interest: Support for Windows Subystem for Linux (WSL2)

@MedAnd
Copy link
Author

MedAnd commented Sep 11, 2019

For anyone interested or landing on this request, as per the tweet for @ChackDan and @dkkapur, LCOW is already working internally and being used by the Azure Functions platform...

@darraghjones
Copy link

@RajeetN Around 18 months ago, you said:

No Service Fabric does not support Linux containers on windows today. We are working on enabling this for a future release

Has there been any progress on this feature? Or if not, are you still intending to enable this in future releases?

@priyankajayaswal1
Copy link

Had a similar work requirement to be able to run linux containers in Windows. Haven't found any documentation for the same, so had to go with the onebox setup and have sf linux cluster for container applications, but facing issues there as well. Can someone help me to understand what I might be doing wrong or what would be the better way to do it.

If linux containers work in SF cluster that would be best. Otherwise can I fix how I have presently tried it to make it work eventually?

microsoft/service-fabric#925

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests