Windows 2022
Sponsored Link

Docker : Add Container Images2022/01/21

 
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   ltsc2022   11cbc9e36c7a   4 days ago   4.95GB

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

Image Version: 10.0.20348.473

Enabling feature(s)

The operation completed successfully.

PS C:\Users\Administrator> (docker ps -a)[0..1] 
CONTAINER ID   IMAGE                                           COMMAND                  CREATED          STATUS
             PORTS     NAMES
7a632e8477bf   mcr.microsoft.com/windows/servercore:ltsc2022   "powershell -c 'dism…"   2 minutes ago    Exited (0) 15 seconds ago                     brave_brahmagupta

# add the image
PS C:\Users\Administrator> docker commit 7a632e8477bf srv.world/iis 
sha256:f815baae1cc7e2de352acc64187a488c064e4ce631ea36d91e6fd41bc67c4ef8

# display images
PS C:\Users\Administrator> docker images 
REPOSITORY                             TAG        IMAGE ID       CREATED          SIZE
srv.world/iis                          latest     f815baae1cc7   20 seconds ago   5.07GB
mcr.microsoft.com/windows/servercore   ltsc2022   11cbc9e36c7a   4 days ago       4.95GB

# 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