Windows 2016
Sponsored Link

Docker : Add new Container Image2019/03/04

 
Add Images for Containers.
[1] For exmaple, update official image with installing IIS and add it as a new image for 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

REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE
microsoft/windowsservercore   latest              ea9f7aa13d03        7 weeks ago         11GB

# start a Container and install IIS

PS C:\Users\Administrator>
docker run microsoft/windowsservercore powershell -c "dism.exe /online /enable-feature /all /featurename:iis-webserver /NoRestart"

Deployment Image Servicing and Management tool
Version: 10.0.14393.0

Image Version: 10.0.14393.2457

Enabling feature(s)

The operation completed successfully.

PS C:\Users\Administrator>
(docker ps -a)[0..1]

CONTAINER ID        IMAGE                         COMMAND                    CREATED              STATUS                     PORTS   NAMES
09df8de48f27        microsoft/windowsservercore   "powershell -c 'dism..."   About a minute ago   Exited (0) 27 seconds ago          determined_ishizaka

# add IIS installed image

PS C:\Users\Administrator>
docker commit 09df8de48f27 srv.world/iis

sha256:134153635645b3785e8daa6ea72c651c9a13c102279ee78b8d686fbf78bccbcd

# show images

PS C:\Users\Administrator>
docker images

REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE
srv.world/iis                 latest              134153635645        44 seconds ago      11.3GB
microsoft/windowsservercore   latest              ea9f7aa13d03        7 weeks ago         11GB

# 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'"


Running  W3SVC              World Wide Web Publishing Service

Matched Content