Windows_Router Memo/Windows2016TP4-Container
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
*Windows Server 2016 Technical Preview 4(TP4)でWindows Se...
RIGHT:更新日 &lastmod();
Windows Server上でDockerと同じようにアプリケーションを「...
''利用イメージ''
------------------------ コンテナ作成 ---------------...
|WindowsServerCore |--------------→|コンテナ ...
| (コンテナイイメージ) | |(アプリをイン...
------------------------ ---------------...
|
|コン...
|
--------------...
|アプリ入りコ...
--------------...
|
|
----------------------- ---------------...
|アプリを追加し | | リポジトリ...
| コンテナを利用 | コンテナ作成 | ...
| | ←----------------| ...
----------------------- --------------...
リポジトリとあるコンテナイメージから派生していろんなア...
したコンテナができる(共通アプリをインストールした時点...
リポジトリに保管しておく)
***Install [#g0e750a6]
-サーバの機能にContainersを追加
&ref("./Win-Docker1.png");
-サービス、ネットワークアダプタの確認
&ref("./Win-Docker3.png");
***コンテナイメージやセットアップスクリプトをダウンロード...
&color(red){''PowerShellを管理者権限で実行''};
cd \
PS C:\> wget -uri https://aka.ms/tp4/Install-ContainerHo...
PS C:\ .\Install-ContainerHost.ps1
Querying status of Windows feature: Containers...
Feature Containers is already enabled.
Waiting for Hyper-V Management...
Enabling container networking...
Creating container switch (NAT)...
Creating NAT for 172.16.0.0/12...
Installing ContainerProvider package...
Getting Container OS image (WindowsServerCore) version 1...
(this may take a few minutes)...
(1時間以上DLにかかる)
←ここで[Enter]が必要なときもある
Container base image install complete. Querying contain...
The following images are present on this machine:
ContainerImage (Name = 'WindowsServerCore') [Publish...
Installing Docker...
Creating Docker program data...
This script uses a third party tool: NSSM. For more info...
Downloading NSSM...
Extracting NSSM from archive...
Configuring NSSM for Docker service...
Waiting for Docker daemon...
Successfully connected to Docker Daemon.
Tagging new base image (6801d964fda5)...
Base image is now tagged:
windowsservercore 10.0.10586.0 6801d964fda5 ...
windowsservercore latest 6801d964fda5 ...
Script complete!
コンテナOSイメージが「C:\ProgramData\Microsoft\Windows\Im...
に入る。
&ref("./Win-Docker4.png");
Docker Daemonのインストールも行われる。
&ref("./Win-Docker2.png");
''コンテナ関係のコマンド''
PS C:\> Get-Command -Module Containers
CommandType Name ...
----------- ---- ...
Function Install-ContainerOSImage ...
Function Uninstall-ContainerOSImage ...
Cmdlet Add-ContainerNetworkAdapter ...
Cmdlet Add-ContainerSharedFolder ...
Cmdlet Connect-ContainerNetworkAdapter ...
Cmdlet Disconnect-ContainerNetworkAdapter ...
Cmdlet Export-ContainerImage ...
Cmdlet Get-Container ...
Cmdlet Get-ContainerHost ...
Cmdlet Get-ContainerImage ...
Cmdlet Get-ContainerMemory ...
Cmdlet Get-ContainerNetworkAdapter ...
Cmdlet Get-ContainerProcessor ...
Cmdlet Get-ContainerSharedFolder ...
Cmdlet Get-ContainerStorage ...
Cmdlet Import-ContainerImage ...
Cmdlet Move-ContainerImageRepository ...
Cmdlet New-Container ...
Cmdlet New-ContainerImage ...
Cmdlet Remove-Container ...
Cmdlet Remove-ContainerImage ...
Cmdlet Remove-ContainerNetworkAdapter ...
Cmdlet Remove-ContainerSharedFolder ...
Cmdlet Set-Container ...
Cmdlet Set-ContainerMemory ...
Cmdlet Set-ContainerNetworkAdapter ...
Cmdlet Set-ContainerProcessor ...
Cmdlet Set-ContainerSharedFolder ...
Cmdlet Set-ContainerStorage ...
Cmdlet Start-Container ...
Cmdlet Stop-Container ...
Cmdlet Test-ContainerImage ...
&color(red){TP5までは上ののコマンドが利用出来るが、Window...
-理由 : https://docs.microsoft.com/ja-jp/virtualization/w...
正式版は3つしかない(2017/3)
PS C:\Windows\system32> Get-Command -Module Containers
CommandType Name ...
----------- ---- ...
Cmdlet Get-ContainerNetwork ...
Cmdlet New-ContainerNetwork ...
Cmdlet Remove-ContainerNetwork ...
''Windowsのコンテナイメージの確認''
PS C:\> Get-ContainerImage
Name Publisher Version IsOSImage
---- --------- ------- ---------
WindowsServerCore CN=Microsoft 10.0.10586.0 True
''コンテナ作成''
PS C:\> New-Container -Name "IsmContainer" -ContainerIma...
Name State Uptime ParentImageName
---- ----- ------ ---------------
IsmContainer Off 00:00:00 WindowsServerCore
-Name:コンテナ名
-ContainerImageName:テンプレートとなるコンテナイメージ
-SwitchName:コンテナが接続する仮想スイッチ、"Get-VMSwitc...
''コンテナの確認''
PS C:\> Get-Container
Name State Uptime ParentImageName
---- ----- ------ ---------------
IsmContainer Off 00:00:00 WindowsServerCore
''SWの確認''
PS C:\> Get-VMSwitch
Name SwitchType NetAdapterInterfaceDescription
---- ---------- ------------------------------
Virtual Switch NAT
''コンテナの起動''
PS C:\> Start-Container -Name IsmContainer
PS C:\> Get-Container
Name State Uptime ParentImageName
---- ----- ------ ---------------
IsmContainer Running 00:00:07.0770000 WindowsServerCore
^^^^^^^ Off→ Runnig
***起動したコンテナを管理するには、PowerShellをリモートか...
''コンテナに入る''
PS C:\> $Container = Get-Container -Name "IsmContainer"
PS C:\> Enter-PSSession -ContainerId $Container.Containe...
[IsmContainer]: PS C:\Windows\system32>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^コンテナ内のshell
[IsmContainer]: PS C:\Windows\system32> ping 192.168.10....
Pinging 192.168.10.245 with 32 bytes of data:
Reply from 192.168.10.245: bytes=32 time<1ms TTL=63
Reply from 192.168.10.245: bytes=32 time<1ms TTL=63
[IsmContainer]: PS C:\Windows\system32> tracert 192.168....
Tracing route to bhr-4grv.ism21.net [192.168.10.245]
over a maximum of 30 hops:
1 * * * Request timed out.
2 <1 ms <1 ms <1 ms bhr-4grv.ism21.net [192....
[IsmContainer]: PS C:\Windows\system32> ping www.google....
Pinging www.google.co.jp [216.58.221.163] with 32 bytes ...
Reply from 216.58.221.163: bytes=32 time=19ms TTL=55
Reply from 216.58.221.163: bytes=32 time=18ms TTL=55
''コンテナから出る''
[IsmContainer]: PS C:\Windows\system32> exit
PS C:\>
''コンテナのShutdown''
PS C:\> Stop-Container -Name IsmContainer
PS C:\> Get-Container
Name State Uptime ParentImageName
---- ----- ------ ---------------
IsmContainer Off 00:00:00 WindowsServerCore
^^^
''コンテナの削除''
> Get-Container -Name "IISContainer" | Remove-Container ...
**参考 [#dd832411]
-http://codename2010.blog11.fc2.com/blog-entry-268.html
-https://www.gmo.jp/report/single/?art_id=200
終了行:
*Windows Server 2016 Technical Preview 4(TP4)でWindows Se...
RIGHT:更新日 &lastmod();
Windows Server上でDockerと同じようにアプリケーションを「...
''利用イメージ''
------------------------ コンテナ作成 ---------------...
|WindowsServerCore |--------------→|コンテナ ...
| (コンテナイイメージ) | |(アプリをイン...
------------------------ ---------------...
|
|コン...
|
--------------...
|アプリ入りコ...
--------------...
|
|
----------------------- ---------------...
|アプリを追加し | | リポジトリ...
| コンテナを利用 | コンテナ作成 | ...
| | ←----------------| ...
----------------------- --------------...
リポジトリとあるコンテナイメージから派生していろんなア...
したコンテナができる(共通アプリをインストールした時点...
リポジトリに保管しておく)
***Install [#g0e750a6]
-サーバの機能にContainersを追加
&ref("./Win-Docker1.png");
-サービス、ネットワークアダプタの確認
&ref("./Win-Docker3.png");
***コンテナイメージやセットアップスクリプトをダウンロード...
&color(red){''PowerShellを管理者権限で実行''};
cd \
PS C:\> wget -uri https://aka.ms/tp4/Install-ContainerHo...
PS C:\ .\Install-ContainerHost.ps1
Querying status of Windows feature: Containers...
Feature Containers is already enabled.
Waiting for Hyper-V Management...
Enabling container networking...
Creating container switch (NAT)...
Creating NAT for 172.16.0.0/12...
Installing ContainerProvider package...
Getting Container OS image (WindowsServerCore) version 1...
(this may take a few minutes)...
(1時間以上DLにかかる)
←ここで[Enter]が必要なときもある
Container base image install complete. Querying contain...
The following images are present on this machine:
ContainerImage (Name = 'WindowsServerCore') [Publish...
Installing Docker...
Creating Docker program data...
This script uses a third party tool: NSSM. For more info...
Downloading NSSM...
Extracting NSSM from archive...
Configuring NSSM for Docker service...
Waiting for Docker daemon...
Successfully connected to Docker Daemon.
Tagging new base image (6801d964fda5)...
Base image is now tagged:
windowsservercore 10.0.10586.0 6801d964fda5 ...
windowsservercore latest 6801d964fda5 ...
Script complete!
コンテナOSイメージが「C:\ProgramData\Microsoft\Windows\Im...
に入る。
&ref("./Win-Docker4.png");
Docker Daemonのインストールも行われる。
&ref("./Win-Docker2.png");
''コンテナ関係のコマンド''
PS C:\> Get-Command -Module Containers
CommandType Name ...
----------- ---- ...
Function Install-ContainerOSImage ...
Function Uninstall-ContainerOSImage ...
Cmdlet Add-ContainerNetworkAdapter ...
Cmdlet Add-ContainerSharedFolder ...
Cmdlet Connect-ContainerNetworkAdapter ...
Cmdlet Disconnect-ContainerNetworkAdapter ...
Cmdlet Export-ContainerImage ...
Cmdlet Get-Container ...
Cmdlet Get-ContainerHost ...
Cmdlet Get-ContainerImage ...
Cmdlet Get-ContainerMemory ...
Cmdlet Get-ContainerNetworkAdapter ...
Cmdlet Get-ContainerProcessor ...
Cmdlet Get-ContainerSharedFolder ...
Cmdlet Get-ContainerStorage ...
Cmdlet Import-ContainerImage ...
Cmdlet Move-ContainerImageRepository ...
Cmdlet New-Container ...
Cmdlet New-ContainerImage ...
Cmdlet Remove-Container ...
Cmdlet Remove-ContainerImage ...
Cmdlet Remove-ContainerNetworkAdapter ...
Cmdlet Remove-ContainerSharedFolder ...
Cmdlet Set-Container ...
Cmdlet Set-ContainerMemory ...
Cmdlet Set-ContainerNetworkAdapter ...
Cmdlet Set-ContainerProcessor ...
Cmdlet Set-ContainerSharedFolder ...
Cmdlet Set-ContainerStorage ...
Cmdlet Start-Container ...
Cmdlet Stop-Container ...
Cmdlet Test-ContainerImage ...
&color(red){TP5までは上ののコマンドが利用出来るが、Window...
-理由 : https://docs.microsoft.com/ja-jp/virtualization/w...
正式版は3つしかない(2017/3)
PS C:\Windows\system32> Get-Command -Module Containers
CommandType Name ...
----------- ---- ...
Cmdlet Get-ContainerNetwork ...
Cmdlet New-ContainerNetwork ...
Cmdlet Remove-ContainerNetwork ...
''Windowsのコンテナイメージの確認''
PS C:\> Get-ContainerImage
Name Publisher Version IsOSImage
---- --------- ------- ---------
WindowsServerCore CN=Microsoft 10.0.10586.0 True
''コンテナ作成''
PS C:\> New-Container -Name "IsmContainer" -ContainerIma...
Name State Uptime ParentImageName
---- ----- ------ ---------------
IsmContainer Off 00:00:00 WindowsServerCore
-Name:コンテナ名
-ContainerImageName:テンプレートとなるコンテナイメージ
-SwitchName:コンテナが接続する仮想スイッチ、"Get-VMSwitc...
''コンテナの確認''
PS C:\> Get-Container
Name State Uptime ParentImageName
---- ----- ------ ---------------
IsmContainer Off 00:00:00 WindowsServerCore
''SWの確認''
PS C:\> Get-VMSwitch
Name SwitchType NetAdapterInterfaceDescription
---- ---------- ------------------------------
Virtual Switch NAT
''コンテナの起動''
PS C:\> Start-Container -Name IsmContainer
PS C:\> Get-Container
Name State Uptime ParentImageName
---- ----- ------ ---------------
IsmContainer Running 00:00:07.0770000 WindowsServerCore
^^^^^^^ Off→ Runnig
***起動したコンテナを管理するには、PowerShellをリモートか...
''コンテナに入る''
PS C:\> $Container = Get-Container -Name "IsmContainer"
PS C:\> Enter-PSSession -ContainerId $Container.Containe...
[IsmContainer]: PS C:\Windows\system32>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^コンテナ内のshell
[IsmContainer]: PS C:\Windows\system32> ping 192.168.10....
Pinging 192.168.10.245 with 32 bytes of data:
Reply from 192.168.10.245: bytes=32 time<1ms TTL=63
Reply from 192.168.10.245: bytes=32 time<1ms TTL=63
[IsmContainer]: PS C:\Windows\system32> tracert 192.168....
Tracing route to bhr-4grv.ism21.net [192.168.10.245]
over a maximum of 30 hops:
1 * * * Request timed out.
2 <1 ms <1 ms <1 ms bhr-4grv.ism21.net [192....
[IsmContainer]: PS C:\Windows\system32> ping www.google....
Pinging www.google.co.jp [216.58.221.163] with 32 bytes ...
Reply from 216.58.221.163: bytes=32 time=19ms TTL=55
Reply from 216.58.221.163: bytes=32 time=18ms TTL=55
''コンテナから出る''
[IsmContainer]: PS C:\Windows\system32> exit
PS C:\>
''コンテナのShutdown''
PS C:\> Stop-Container -Name IsmContainer
PS C:\> Get-Container
Name State Uptime ParentImageName
---- ----- ------ ---------------
IsmContainer Off 00:00:00 WindowsServerCore
^^^
''コンテナの削除''
> Get-Container -Name "IISContainer" | Remove-Container ...
**参考 [#dd832411]
-http://codename2010.blog11.fc2.com/blog-entry-268.html
-https://www.gmo.jp/report/single/?art_id=200
ページ名: