Repository navigation
3. Create New Project and Dockerize the Project
Here, we are going to create the ASP.NET Core Web API with default template and Add Docker Support to the project.
-
Open Visual Studio and Click New => Project => In the dialog selects ASP.NET Core Web API and click Next
-
Next, Enter appropriate Project Name, Solution name and Location, then click Next.
-
Select your Target Framework, then Enable Docker and select Linux Container then click Create.
NOTE: If you enable Docker, file will automatically generate in your project else you need to initiate manually
Step 1.

Step 2.
-
After the Project creation, Run the App with IIS Express then see the below output.
-
Open the Commend Prompt, PowerShell or visual studio code (if not already opened) and navigate to the project folder.
-
To build the Web API and run the below command.
docker build -t kubehelmapi -f "KubeHelpAPI/DockerFile" . -
Next, Verify your Docker Image is created via below command.
docker images
-
Run the Web API Docker Image via below command.
docker run -t -p 8080:80 kubehelmapi:latest -
To Validate API Open Either Browser and enter http://localhost:8080/weatherforecast to view the below result,
-
Create an account in docker hub if not exist via URL, else skip this step,
-
Open PowerShell
-
Enter the Below command to Authenticate docker Login,
docker login
NOTE: Change your docker registry name before executing command on Step 4 & 5.
-
Run the below command to tag the Web API with docker registry.
docker tag kubehelmapi <your-docker-registry-name>/kubehelmapi -
Push the Tagged Image to docker hub via below command,
docker push <your-docker-registry-name>/kubehelmapi