Introduction
In this article I am going to provide step by step tutorial how to create docker image for sample dotnet core console sample application.
Prerequisites
Below framework needs to be installed on the dev machine
Dotnet core & docker
Steps
1. Create sample console application in c# core as below
2. Compile and publish the application in a folder named PublishOutput.
3. Run Command Prompt Windows from PublishOutput directory/folder (cmd should point to PublishOutput folder) and type notepad Dockerfile.
4. Save the file.
5. Make the below entry in the file and save again
7. >docker run testapp
In this article I am going to provide step by step tutorial how to create docker image for sample dotnet core console sample application.
Prerequisites
Below framework needs to be installed on the dev machine
Dotnet core & docker
Steps
1. Create sample console application in c# core as below
using System;
namespace ConsoleApp1
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Test Program");
}
}
}
namespace ConsoleApp1
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Test Program");
}
}
}
round-color: black; color: white; padding: 20pxdsfjfaskdjf
2. Compile and publish the application in a folder named PublishOutput.
3. Run Command Prompt Windows from PublishOutput directory/folder (cmd should point to PublishOutput folder) and type notepad Dockerfile.
4. Save the file.
5. Make the below entry in the file and save again
FROM microsoft/dotnet:onbuild
ENTRYPOINT ["dotnet", "ConsoleApp1.dll"]
6. Execute >docker build -t testapp . ENTRYPOINT ["dotnet", "ConsoleApp1.dll"]
7. >docker run testapp
No comments:
Post a Comment