What is Docker by the way?
Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly.
With Docker, you can manage your infrastructure in the same ways you manage your applications. — Docker
Written in: Go
Initial release date: March 20, 2013
Developer: Docker, Inc.
1. Generate new project by using the command:
— dotnet new webapi -o AspNetCoreDockerTest
— cd AspNetCoreDockerTest
2. Open the project by using the command:
— code .
1. If your project not generated .vscode please enter the command:
(Ctrl+Shift+P) and Select .NET: Generate Assets for Building and Debug
2. Please select Yes if you get notified like this:
3. Please install Docker extension .
Let’s get started with Docker:
1. You need to install docker desktop in this url: Docker and make sure that docker is running.
2. In your project in vscode enter (Ctrl+Shift+P) and search for the following
> Docker: Add Docker Files to Workspace..
> ASP.NET Core
It will generate: Dockerfile (if you can’t generate the file, add Dockerfile manually).
Per line explanation (by my own understanding).
1. We are using the mcr.microsoft.com/dotnet/core/aspnet:3.1 repository and Creating asp.net 3.1 app and tagging as layer base.
2. Your /app as working directory
3. And exposing to the port 80
5. We are using the mcr.microsoft.com/dotnet/core/sdk:3.1 repository and Creating as src/source of the project as build.
6. Your /src working directory
7. Copy the project file AspNetCoreDockerTest.csproj into the root of the project directory “./”
8. Restore all dependecies of the project.
9. Copy all the files into same location
10. Build the project as a release version into /app directory
13. use the same line and same configuration of line number 10 to create a release on /app directory
15. Switching to /app directory
16. Copy the files from publish directory to /app directory.
18. After all the process the entry point will be [“dotnet”, “AspNetCoreDockerTest.dll”]
Running image commands:
1. docker build -t asp-net-core-docker-test:v1 .
— it will download images for aspnet 3.1 and sdk 3.1 (wait until the download done).
2. to verify the image, enter command: docker images
3. to run the image, enter the command: docker run -t --rm -p:9090:80 asp-net-core-docker-test:v1
Looking for a JOB? Signup @ jobbhy and be notified!
Want to post a JOB as employer? Contact and be one us!
Axios Refresh Token (A simple and straightforward request interceptor.)