Boris Eetgerink

March 25, 2023

Using dotnet watch from a Docker container

Run this command from the directory of the web application. I don't recommend it as daily development workflow, as the container adds quite some performance overhead, but it's great if you need to check how something works when running in a container.

docker run -it --rm
  --mount type=bind,src="$(pwd)",target=/app
  -p 5000:5000
  -e "some_token=abc42"
  mcr.microsoft.com/dotnet/sdk:7.0
  dotnet watch run --project /app --urls http://0.0.0.0:5000

The application is now running on http://localhost:5000/.

About Boris Eetgerink

Hey, thanks for reading my blog. Subscribe below for future posts like this one and check my personal site in order to contact me.