…
|
||
---|---|---|
.. | ||
Dockerfile | ||
dotnetbot.csproj | ||
Program.cs | ||
README.md |
dotnet-bot Sample
The dotnet-bot sample demonstrates "hello world" type usage of .NET Core. It displays dotnet-bot, the open source mascot for .NET Core projects. This sample is very similar to the Docker whalesay sample.
Topics
You will exercise the following topics in this sample.
- Building and running a .NET Core application.
- Creating a Docker image for a .NET Core application.
- Running a .NET Core application in container.
Script
Follow these steps to try out this sample. The instructions are intended to be Operating System agnostic, unless called out.
Preparing your Environment
- Install the .NET Core SDK for your operating system.
- Git clone this repository or otherwise copy this sample to your machine:
git clone https://github.com/dotnet/core/
- Navigate to the sample on your machine at the command prompt or terminal.
Run the application
- Restore dependencies:
dotnet restore
- Run application:
dotnet run
- Alternatively, you can build and directly run your application with the following two commands:
dotnet build
dotnet bin/Debug/netcoreapp1.0/dotnetbot.dll
- You can also try passing input to the sample to get the dotnet-bot to say something:
dotnet run dotnet-bot is a great teacher
Dockerize the application
The Docker instructions are OS agnostic, however, the Dockerfile used relies on a Linux image.
- Install the Docker tools for your operating system.
- Build a Docker container, as specified by the Dockerfile:
docker build -t dotnetbot .
- Run the application in the container:
docker run dotnetbot Hello .NET Core from Docker