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)
Nhận xét
Đăng nhận xét