Hướng dẫn cơ bản tạo Docker chứa ASP net web app không có Database


  • Create web app
  • Public web app to a folder
  • Using cmd or powershell to move to public folder
  • At this folder:
    • Create Dockerfile (file with no extension) with content:
# The `FROM` instruction specifies the base image. You are
# extending the `microsoft/aspnet` image.

FROM microsoft/aspnet

# Next, this Dockerfile creates a directory for your application
RUN md C:\mvcwebappdb

# configure the new site in IIS.
RUN powershell -NoProfile -Command \
   Import-module IISAdministration; \
   New-IISSite -Name "ASPNET" -PhysicalPath C:\mvcwebappdb -BindingInformation "*:8000:"

# This instruction tells the container to listen on port 8001.
EXPOSE 8000

# The final instruction copies the site you published earlier into the container.
COPY . C:\mvcwebappdb
    • $docker build -t mvcwebappdb .
    • $docker run -d -p 8000:8000 --name mvcwebappdb-container  mvcwebappdb
    • $docker inspect -f "{{ .NetworkSettings.Networks.nat.IPAddress }}" mvcwebappdb-container to get IP to run browser (this version can not run http://localhost, must run on IP container)
Ex: http://172.28.103.18

Nhận xét

Bài phổ biến

Hướng dẫn cơ bản dùng ReactJs server-side rendering với MVC 4&5

Hướng dẫn cơ bản tạo file ảnh Docker sql server , attach database

Tạo docker file cho Node JS web app

Các lệnh thường dùng cho Docker nên biết