Mastering Windows Server 2016 Hyper-V

(Romina) #1

1239394e5a8a: Already exists
847199668046: Pulling fs layer
4b1361d2706f: Pulling fs layer
847199668046: Verifying Checksum
847199668046: Download complete
847199668046: Pull complete
4b1361d2706f: Verifying Checksum
4b1361d2706f: Download complete
4b1361d2706f: Pull complete
Digest:
sha256:1d64cc22fbc56abc96e4b7df1b51e6f91b0da1941aa155f545f14dd76ac522fc
Status: Downloaded newer image for microsoft/iis:latest


PS C:> docker images
REPOSITORY TAG IMAGE ID
CREATED SIZE
microsoft/iis latest accd044753c1 6
days ago 7.907 GB
microsoft/windowsservercore latest 02cb7f65d61b 8
weeks ago 7.764 GB
microsoft/nanoserver latest 3a703c6e97a2 8
weeks ago 969.8 MB


Something may look strange about the output of docker images. The size of the IIS
image is larger than the windowsservercore image, and the whole point of containers
and images is that they build on each other and contain only the deltas. That is exactly
what is happening; however, the size shows the total size of the image and the images
it depends upon. If you dig around C:\programdata\docker\ on the filesystem, you
would find that only one folder under windowsfilter is close to the actual size: that of
the windowsservercore base OS image.


The following is a basic Dockerfile that I would save as a Dockerfile on the filesystem
(with no extension). It specifies to use the iis image that is built on
windowsservercore, delete the iisstart.htm file (which will not actually delete from
the iis image since it’s read-only, but it will make that change in my sandbox space),
and then copy the contents of a local folder named website on my machine into the
/inetpub/wwwroot folder insider the container:


FROM microsoft/iis
RUN del C:\inetpub\wwwroot\iisstart.htm
COPY /website /inetpub/wwwroot


I build a custom image from this Dockerfile (in the same folder, I also have a folder
named website containing my new website content). Then I create a container
instance from my custom image, mapping port 8080 of the container host IP (because
I’m using a NAT network) to port 80 on the actual container:


C:\dockerdemo>docker build ‐t demosite .
Sending build context to Docker daemon 234 kB
Step 1 : FROM microsoft/iis
---> accd044753c1
Step 2 : RUN del C:\inetpub\wwwroot\iisstart.htm
---> Running in efc2aeaa17df

Free download pdf