Introduction
Welcome to Docker's .NET Conf lab!
This lab gets you using .NET Core in Docker containers. You'll experience compiling code, packaging apps and running containers, using the .NET Core 3.0 release.
Welcome to Docker's .NET Conf lab!
This lab gets you using .NET Core in Docker containers. You'll experience compiling code, packaging apps and running containers, using the .NET Core 3.0 release.
Clone the application source into /home/labex/project
path:
Just click the text in these boxes to send the command to your terminal
git clone https://github.com/dockersamples/dotnetconf19.git
Now browse to the source code folder dotnetconf19
:
cd dotnetconf19
In there you'll see a folder called src
which contains the .NET code and a file called Dockerfile
whch contains the instructions to build and package the app:
ls
The Dockerfile
has dotnet
commands to restore NuGet packages and publish the app:
cat Dockerfile
Even if you're not familiar with the Dockerfile syntax, you can kind of work out that this is a script to compile the app and package it up to run
You run the script with the docker build
command, which produces a container package called a Docker image:
docker build --tag dotnetconf:19 .
You'll see lots of download progress bars, and some familiar output from MSBuild.
The final message Successfully tagged dotnetconf:19
tells you the image has been built and given the tag dotnetconf:19
- which is just the image name.
A Docker image is a complete packaged app. You can share it on Docker Hub, which is how thousands of open-source and commercial projects now distribute their software.
Your image contains the .NET Core 3.0 runtime, together with the assemblies and configuration for the demo app.
You run the app by running a container from the image:
docker run dotnetconf:19
Scroll up to read the message from .NET Bot - that's your .NET Conf code!
If you want to learn more about what's happened here and how you can use Docker to build cross-platform apps that run on Windows, Linux, Itenal and Arm - check out this blog post:
Congratulations! You have completed the .NET Conf 2019 lab. You can practice more labs in LabEx to improve your skills.