Can I Run a dotnet app which is hosted on IIS in a docker container?

I have developed a web application using asp dotnet and currently I have it running on IIS is there anyway I can run the same app in a docker container,

I am relatively new to Docker and I have played around a bit and I am familiar with docker compose , so I was wondering if I can (dockerize) the application that I have developed.

  • How to access my docker container (Notebook) over the Internet. My host is running on Google Cloud
  • How to cache node_modules on Docker build?
  • How to configure nginx to forward all unhandled domains to particular service?
  • Gitlab-ci configure docker runner for deployment with SSH keys
  • Deleting all docker images and containers
  • Mule 3.7 insufficient memory for JVM
  • My Dockerfile now looks like:

    #Making a dotnet container
    FROM microsoft/dotnet:latest
    #Make a directory
    WORKDIR /app
    #copy dll files and other dependencies
    COPY . /app
    #dotnet run should run the app

    From what I understand this makes a directory inside my dotnet container and copies the files in the current folder and the app will run on dotnet run

  • Running Disco in a Docker container
  • neo4j-mazerunner, How to Increase memory size in docker-compose.yml
  • Getting an error while trying to use a command under the lifecycle tag on kubernetes
  • Best Docker logging architecture using ELK stack
  • What information is kept by a non-running docker container?
  • how to communicate from a docker container to a docker-machine?
  • One Solution collect form web for “Can I Run a dotnet app which is hosted on IIS in a docker container?”

    You need to change a little your Dockerfile, try this:

    #Making a dotnet container
    FROM microsoft/iis
    SHELL ["powershell"]
    RUN Install-WindowsFeature NET-Framework-45-ASPNET ; \  
        Install-WindowsFeature Web-Asp-Net45
    RUN Remove-WebSite -Name 'Default Web Site'  
    RUN New-Website -Name 'app' -Port 80 \  
        -PhysicalPath 'c:\app' -ApplicationPool '.NET v4.5'
    #copy dll files and other dependencies
    COPY app app
    #dotnet run should run the app
    CMD ["ping", "-t", "localhost"]  

    Test it

    docker build -t app .  
    docker run --name app -d -p 80:80 app
    docker inspect --format="{{.NetworkSettings.Networks.nat.IPAddress}}" app

    It will give you an ip just test it in your browser.

    More information: Run IIS + ASP.NET on Windows 10 with Docker

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.