Professional Documents
Culture Documents
Install Docker that is the Operating System-Level Virtualization Tool, that automates the
deployment of applications inside Containers.
On Windows Server 2016, Hyper-V is not required for installing Docker, only [Containers]
feature is needed.
Run PowerShell with Admin and run the command like follows to enable Container feature.
(also possible to enable on [Server Manager] - [Add roles and features] - [Containers].
[1]
After enabling it, Restart Computer.
PS > Enable-WindowsOptionalFeature -Online -FeatureName Containers
After rebooting, run PowerShell with Admin again and run the command like follows to
install Docker.
[2] Answer with Y(es) to questions during the installation.
PS > Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
PS > Install-Package -Name docker -ProviderName DockerMsftProvider
After installing Docker, [Docker Engine] service has been added with [Automatic] Startup
[3]
in Services. Restart computer again.
After rebooting, run PowerShell and run the command like follows to verify installation
[4] normally.
PS > docker version
Docker : Basic Usage
# list images
PS C:\Users\Administrator> docker images
REPOSITORY TAG IMAGE ID
CREATED SIZE
microsoft/windowsservercore latest ea9f7aa13d03
7 weeks ago 11GB
Connect to the interactive session of a Container with [i] and [t] option like follows. If exit
[2]
from the Container session, the process of a Container finishes.
PS C:\Users\Administrator> docker run -i -t
microsoft/windowsservercore powershell
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
PS C:\> systeminfo
.....
.....
PS C:\> exit
PS C:\Users\Administrator> # back
If exit from the Container session with keeping container's process, push Ctrl+p, and
[3]
Ctrl+q key.
PS C:\Users\Administrator> docker run -it microsoft/windowsservercore
powershell
Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.
PS C:\Users\Administrator>
PS C:\Users\Administrator> docker ps
CONTAINER ID IMAGE COMMAND
CREATED STATUS PORTS NAMES
5337b53aeb49 microsoft/windowsservercore "powershell"
28 seconds ago Up 25 seconds sharp_wu
PS C:\> hostname
5337b53aeb49
PS C:\>
PS C:\Users\Administrator> docker ps
CONTAINER ID IMAGE COMMAND CREATED
STATUS PORTS NAMES
Docker : Add new Container Image
2
Add Images for Containers.
For exmaple, update official image with installing IIS and add it as a new image for
[1] container. The container is generated every time for executing docker run command,
so add the latest executed container like follows.
# show images
PS C:\Users\Administrator>
docker images
PS C:\Users\Administrator>
docker run microsoft/windowsservercore powershell -c "dism.exe /online /enable-feature /all
/featurename:iis-webserver /NoRestart"
Enabling feature(s)
PS C:\Users\Administrator>
(docker ps -a)[0..1]
PS C:\Users\Administrator>
docker commit 09df8de48f27 srv.world/iis
sha256:134153635645b3785e8daa6ea72c651c9a13c102279ee78b8d686fbf78bccbcd
# show images
PS C:\Users\Administrator>
docker images
# Generate a Container from the new image and verify IIS is running
PS C:\Users\Administrator>
docker run srv.world/iis powershell -c "Get-Service | Out-String -Stream | Select-String
'W3SVC'"
M a t c h e d C o n t e n t