Docker
Introduction
Reference:
Prerequisites:
Tip: If you want to run VS Code from the terminal, append the following to your ~/.bash_profile
file (~/.zshrc
in case you use zsh).
1 | vim ~/.zshrc |
1 | code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* ;} |
1 | :x |
For the simplest local test, we disable https
1 | dotnet new webapi -o HelloAspNetCore --no-https |
1 | cd HelloAspNetCore |
Click Yes
Run WeatherForecastController.cs
in VsCode
Open Postman to test, Click Send
Install Docker extension in VsCode
Press Command
+ P
, input >Docker: Add Docker Files to Workspace
, then choose your API directory, then select .NetCore
, Linux
, No
, 80
remove this line
1 | docker build -t hello-aspnetcore:v1 |
1 | docker images |
1 | docker run -it --rm -p 8080:80 hello-aspnetcore:v1 |
Press Ctrl
+ c
to exit the docker process.