Mastering Windows Server 2016 Hyper-V

(Romina) #1

assigned on the container host IP.


C:\dockerdemo>docker run ‐‐name demo1 ‐d ‐P demosite ping ‐t localhost
a5c6e7afe7725d504555d425a6a010371747001a2ea7422a54f4ec183034dc55


C:\dockerdemo>docker ps ‐a
CONTAINER ID IMAGE COMMAND CREATED
STATUS PORTS NAMES
a5c6e7afe772 demosite "ping -t localhost" 8 seconds
ago Up 4 seconds 0.0.0.0:3232->80/tcp demo1


To view dependencies between images, use the docker history command. It uses the
image ID that is shown in the docker images command. The following is an example
that shows that my demosite depends on the IIS image, which depends on the
windowsservercore image.


C:\dockerdemo>docker history demosite
IMAGE CREATED CREATED BY
SIZE COMMENT
ab15060e024b 11 minutes ago cmd /S /C #(nop) COPY
dir:290b95092f931d49670 4.805 MB
4232b44c1241 11 minutes ago cmd /S /C del
C:\inetpub\wwwroot\iisstart.htm 142.3 MB
accd044753c1 7 days ago cmd /S /C powershell –
executionpolicy bypass 43.08 kB


7 days ago cmd /S /C #(nop) ADD
file:43092a194a8c2ebb991 7.764 GB

C:\dockerdemo>docker images
REPOSITORY TAG IMAGE ID
CREATED SIZE


85e4f2ebd154 11
minutes ago 7.912 GB
demosite latest ab15060e024b 11
minutes ago 7.912 GB
microsoft/iis latest accd044753c1 7
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

You can upload your images either to Docker Hub or to an on-premises Docker
Trusted Repository via docker login and docker push, but take care not publish
images that are not suitable for public consumption.


In my examples, I have created container instances that have access to all available
resources on the system. It’s also possible, however, to control the resources available
for a container. Docker supports a large range of resource management tools;
however, at the time of this writing, only CPU shares can be configured, and this
applies to Windows containers and not Hyper-V containers. A container instance can
be configured with a CPU share, which is a value relative to other containers. By
default, a container receives a cpu-share value of 500, but it can be anything from 1 to

Free download pdf