This is a repo for users getting started with .NET 8 and Docker. The focus is building (simple) .NET 8 application(s) which would run as a container (on Docker) and how to do this. Example serves different use cases and some could serve as a starter template.
| folder/example | description | extra info and links |
|---|---|---|
| hello-dotnet-container | console output of OS & computer architecture | see also video and original source on github for detailed information |
| WorkerServiceNet8 | Background service with structured logging (serilog) | see also serilog webpage |
To build and execute the examples on docker, you need:
The following environment was used for the examples.
- Windows 11 computer, with following dotnet and docker versions:
$ dotnet --version
8.0.100
$ docker --version
Docker version 24.0.7, build afdd53bYou can try it out on the command line in one of the example folders (as listed in the table), and then ...
cd [example-project]
dotnet publish -t:PublishContainerdocker run -it --rm --entrypoint /bin/bash hello-dotnet-container:latestapp@f7c2c6eb7b25:/app$ whoami
app
app@f7c2c6eb7b25:/app$ ls
hello-dotnet-container.deps.json hello-dotnet-container.exe hello-dotnet-container.runtimeconfig.json
hello-dotnet-container.dll hello-dotnet-container.pdb
app@f7c2c6eb7b25:/app$ exitdocker image list [example-project]example output
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-dotnet-container latest bbf52cfe7ff0 11 seconds ago 85.7MB
docker run --rm [example-project]example
docker run --rm hello-dotnet-container
Hello dot-net-container
OSDescription: Debian GNU/Linux 12 (bookworm)
OSArchitecture: X64!