I have used Visual Studio 2017 (on Windows) to create my .Net Core App
and am trying to run it inside a docker container. Based on their website .NET Core Apps should allow us developers to create cross-platform compatible software;
.NET Core is a cross-platform version of .NET for building websites, services, and console apps.
My attempt on that was to create a .NET Core Console Application;
using System;
using Newtonsoft.Json;
namespace Services
{
class Program
{
static void Main(string[] args)
{
if (Enum.TryParse(
typeof(LoremIpsumGenerator.TypeOfGenerator),
args[0],
true,
out var testParse))
{
Console.WriteLine(
JsonConvert.SerializeObject(
LoremIpsumGenerator
.GenerateText(
int.Parse(args[1]),
(LoremIpsumGenerator.TypeOfGenerator) testParse)));
}
Console.WriteLine("Wrong Parameters!");
}
}
}
Publish it via dotnet publish
and run it by the following;
FROM microsoft/aspnetcore:1.0.13-nanoserver-sac2016 AS base
WORKDIR /Services
COPY /bin/Debug/netcoreapp2.0/publish/ .
ENTRYPOINT ["dotnet", "DockerConsoleTestApp.dll"]
.. however I do always seem to get the following error-message;
image operating system "windows" cannot be used on this platform
.. which I interpret as "You should use Windows-container to run this". But now I am confused since both my console application and my container should both be cross-platform compatible, right? Or am I missing something?