Windows 2025
Sponsored Link

Docker : Add Container Images2024/12/16

 

Add your customized images for Containers.

[1] For exmaple, Install 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.
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

# display images
PS C:\Users\Administrator> docker images 
REPOSITORY                             TAG        IMAGE ID       CREATED      SIZE
mcr.microsoft.com/windows/servercore   ltsc2025   f9fb7d5c26c9   7 days ago   5.14GB

# start a Container and install IIS
PS C:\Users\Administrator> docker run mcr.microsoft.com/windows/servercore:ltsc2025 powershell -c "dism.exe /online /enable-feature /all /featurename:iis-webserver /NoRestart" 
Deployment Image Servicing and Management tool
Version: 10.0.26100.1150

Image Version: 10.0.26100.2605

Enabling feature(s)

The operation completed successfully.

PS C:\Users\Administrator> (docker ps -a)[0..1] 
CONTAINER ID   IMAGE                                           COMMAND                  CREATED              STATUS
        PORTS     NAMES
07221ffe7c2c   mcr.microsoft.com/windows/servercore:ltsc2025   "powershell -c 'dism…"   About a minute ago   Exited (0) 13 seconds ago             vigilant_saha

# add the image
PS C:\Users\Administrator> docker commit 07221ffe7c2c srv.world/iis 
sha256:88abadb6d8ac766dddb677db162092bcf85cc3eebfe6c14bb7d0e98bee1c43a4

# display images
PS C:\Users\Administrator> docker images 
REPOSITORY                             TAG        IMAGE ID       CREATED          SIZE
srv.world/iis                          latest     88abadb6d8ac   28 seconds ago   5.26GB
mcr.microsoft.com/windows/servercore   ltsc2025   f9fb7d5c26c9   7 days ago       5.14GB

# generate a container from the new image and verify IIS is running to access to container's localhost
PS C:\Users\Administrator> docker run srv.world/iis powershell -c "curl.exe localhost" 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>IIS Windows Server</title>
<style type="text/css">
<!--
body {
        color:#000000;
        background-color:#0072C6;
        margin:0;
}
.....
.....
Matched Content