Windows 2019
Sponsored Link

Docker : Add Container Images
2019/02/19
 
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
mcr.microsoft.com/windows/servercore   1809                640a8acbeb6f        6 days ago          4.28GB

# start a Container and install IIS

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

Deployment Image Servicing and Management tool
Version: 10.0.17763.1

Image Version: 10.0.17763.316

Enabling feature(s)

The operation completed successfully.

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

CONTAINER ID        IMAGE                                       COMMAND                 CREATED             STATUS
                     PORTS               NAMES
b8935d684c30        mcr.microsoft.com/windows/servercore:1809   "powershell -c 'dism"   2 minutes ago       Exited (0) About a minute ago                       serene_brahmagupta

# add the image

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

sha256:1f0cbc310aaa3c4f508827dc59be7d5def17235abfbf1fc335b6eafadc4961c5

# show images

PS C:\Users\Administrator>
docker images

REPOSITORY                             TAG                 IMAGE ID            CREATED             SIZE
srv.world/iis                          latest              1f0cbc310aaa        30 seconds ago      4.43GB
mcr.microsoft.com/windows/servercore   1809                640a8acbeb6f        6 days ago          4.28GB

# 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">
.....
.....
Matched Content
 
Tweet