<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title></head><body> <form id="form1" runat="server"> <div> <h3>This is asp.net 3.5 web form </h3> <asp:GridView ID="GridView1" runat="server"></asp:GridView> </div> </form></body></html>
default.aspx.csprotected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.Add("c1", typeof(string));
for (int i = 1; i < 15; i++)
{
dt.Rows.Add(i.ToString());
}
GridView1.DataSource = dt;
GridView1.DataBind();
}
}
建置完成後,就將程式放到本機的某個目錄之中(containerImage),並建立 dockerfile ,如下,# extending the `microsoft/aspnet` image.FROM microsoft/aspnet
# Next, this Dockerfile creates a directory for your applicationRUN mkdir C:\randomanswers
# configure the new site in IIS.RUN powershell -NoProfile -Command \
Import-module IISAdministration; \
New-IISSite -Name "ASPNET" -PhysicalPath C:\randomanswers -BindingInformation "*:8000:"
# This instruction tells the container to listen on port 8000. EXPOSE 8000
# The final instruction copies the site you published earlier into the container.ADD containerImage/ /randomanswers