dotnet publish -t:PublishContainer
$ dotnet new webapp -o webapp
$ cd webapp/
$ dotnet publish -t:PublishContainer
MSBuild version 17.8.3+195e7f5a3 for .NET
Determining projects to restore...
All projects are up-to-date for restore.
webapp -> /home/rich/webapp/bin/Release/net8.0/webapp.dll
webapp -> /home/rich/webapp/bin/Release/net8.0/publish/
Building image 'webapp' with tags 'latest' on top of base image 'mcr.microsoft.com/dotnet/aspnet:8.0'.
Pushed image 'webapp:latest' to local registry via 'docker'.
$ docker run --rm -d -p 8000:8080 webapp
7c7ad33409e52ddd3a9d330902acdd49845ca4575e39a6494952b642e584016e
$ curl -s http://localhost:8000 | grep ASP.NET
<p>Learn about <a href="https://learn.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7c7ad33409e5 webapp "dotnet webapp.dll" About a minute ago Up About a minute 0.0.0.0:8000->8080/tcp, :::8000->8080/tcp jovial_shtern
$ docker kill 7c7ad33409e5
useful links
https://learn.microsoft.com/en-us/dotnet/core/docker/introduction#net-images
