To deploy an ASP.NET web application to a Docker container, follow the below steps:
Publish Preset
1. Create a publish preset using the File System publish method which will result in a .pubxml file.
2. Pull the official ASP.NET image from Microsoft which is,
docker pull microsoft/aspnet
3. Make sure your dockerfile is created,
FROM microsoft/aspnet
COPY ./DockerDeploy/ /inetpub/wwwroot/
4. Now build the docker image using the following command. You can custom the container name as you wish,
docker build -t mywebapplication .
5. Run the container you created,
docker run -p 80:80 mywebapplication
This should definitely work.