Install Windows Docker and Related Software
- Use PowerShell to install the software Docker needs (run as Administrator)
function Install-Chocolatey {
try {
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'));
}
catch {
$ErrorMessage = $_.Exception.Message;
$FailedItem = $_.Exception.ItemName;
Write-Host $ErrorMessage + $FailedItem;
return $false;
}
return $true;
}
Write-Host "Install chocolatey"
Install-Chocolatey;
Write-Host "Install Docker Software"
choco install docker-desktop -y
choco install docker-compose -y
choco install docker-kitematic -y
- After rebooting, open Docker Desktop and switch to Windows Containers.

Build the ASP.NET Website Container
- Pull the ASP.NET Docker image
docker pull mcr.microsoft.com/dotnet/framework/aspnet:4.8
- Build the ASP.NET container, mapping the container's port 80 to the host's port 888.
docker run -it -d --isolation=process -p 888:80 mcr.microsoft.com/dotnet/framework/aspnet:4.8
# -i, --interactive (interactive mode)
# -t, --tty (allocate a terminal)
# -d, --detach (run in the background)
# -- isolation=process (process isolation mode is required to use docker cp)
-
Use docker ps to list running containers and find the container id.

-
Switch to the Release ASP.NET application directory and use docker cp to copy the ASP.NET site into the container's web directory.
C:\WebSite> docker cp . 5d3aadf8028b:c:/inetpub/wwwroot
- The ASP.NET application is now running.

Note 1: The command below opens a terminal inside the container so you can verify all files were copied in.
docker exec -it 5d3aadf8028b cmd
Note 2: Create a new image
docker commit 5d3aadf8028b newImage





























Comments