Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
# 現在登録されているイメージ一覧を表示
PS C:\Users\Administrator> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mcr.microsoft.com/windows/servercore ltsc2025 f9fb7d5c26c9 7 days ago 5.14GB
# 最新のイメージでコンテナーを起動し、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
# IIS をインストールしたイメージを登録
PS C:\Users\Administrator> docker commit 07221ffe7c2c srv.world/iis
sha256:88abadb6d8ac766dddb677db162092bcf85cc3eebfe6c14bb7d0e98bee1c43a4
# 確認
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
# 登録したイメージからコンテナーを生成し localhost にアクセスして IIS 稼働確認
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;
}
.....
.....
|