Sign inSign up

abelgaxiola/ratings

By abelgaxiola

•Updated over 9 years ago

Created using microsoft/asp image. Added IIS website and mapped volume to local folder.

Image
0

201

abelgaxiola/ratings repository overview

⁠Created using microsoft/aspnet

⁠Image size 10.9 GB

Create a folder to generate the Docker image. Create a Docker file inside that folder using the Docker file contents listed below. Create a sub-folder and name it websrc. Create or copy website files inside the websrc sub-folder; this files are the ones that will accessible via the local volume

⁠Contents of the Dockerfile used:

# Indicates the image that will be used as the base image
FROM microsoft/aspnet

# Metadata indicating an image maintainer
MAINTAINER @abelgaxiola

# Uses PowerShell to install the web server role
RUN PowerShell.exe -Command Install-WindowsFeature Web-Server

# Add the framework and delete the default website files
RUN powershell -Command Add-WindowsFeature NET-Framework-45-ASPNET; \
        powershell -Command Add-WindowsFeature Web-Asp-Net45; \
        powershell -Command Remove-Item -Recurse C:\inetpub\wwwroot\*

# Copy the contents of websrc folder into the default website folder
COPY ./websrc c:/inetpub/wwwroot

RUN powershell -Command md 'c:\ratings'; \
         powershell -Command New-Website -Name 'ratings' -Port 8081 -PhysicalPath 'c:\ratings'

# Sets a command or process that will run each time a container is run from the new image
CMD [ "CMD" ]

#    

Docker commands used:

docker build -t ratings .
docker run -it --volume d:\Docker\volumes\ratings:C:\ratings --name ratings ratings
$ip = docker inspect --format '{{ .NetworkSettings.Networks.nat.IPAddress }}' ratings
Start-Process -FilePath http://$ip':8081'

The first command builds the image using the Dockerfile.

The second command loads the image into the container with mapped volume on host 'd:\docker\volumes\ratings' to container 'c:\ratings'.

The third command returns the IP Address of the running image.

The last command will open the browser and display the website (make sure there is a default page inside the host's shared volume). The website can now be viewed and interacted with.

Changes made to the website files located inside the host's d:\docker\volumes\ratings folder will be reflected on the browser by refreshing the page (ctrl-F5).

Tag summary

Content type

Image

Digest

Size

5.1 GB

Last updated

over 9 years ago

docker pull abelgaxiola/ratings:v0