Create a background container docker container run \ --rm \ --detach \ --name iis \ --publish 8080:5000 \ mcr.microsoft.com/dotnet/sdk:latest \ sleep inf sleep 2 Configure it { cat <<'eof2' apt-get update && apt-get install -y tree procps vim net-tools curl mkdir -p /tmp/project cd /tmp/project dotnet new web -n HelloWorldApp cd HelloWorldApp/ mkdir Controllers cut -c3- <<'eof' > Controllers/HomeController.cs using Microsoft.AspNetCore.Mvc; public class HomeController : Controller { public IActionResult Index() { return Content("Hello, World!"); } } eof eof2 } | docker container exec -i iis /bin/bash Run the app docker container exec \ --workdir /tmp/project/HelloWorldApp/ \ iis \ dotnet run --urls http://0.0.0.0:5000 Test the app curl -s http://localhost:8080