107 lines
3.8 KiB
Markdown
107 lines
3.8 KiB
Markdown
# Эксперименты с Windows Containers
|
||
|
||
## Установка Docker (Moby)
|
||
|
||
Требования по ОС включают в себя Windows Server или Windows 10/11 Pro.
|
||
|
||
1. Конфигурируем выполнение сценариев ([PowerShell execution policies](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.5))
|
||
```
|
||
Get-ExecutionPolicy -List
|
||
Get-ExecutionPolicy -Scope CurrentUser
|
||
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||
```
|
||
|
||
2. Выполняем [установку](https://learn.microsoft.com/en-us/virtualization/windowscontainers/quick-start/set-up-environment?tabs=dockerce):
|
||
```
|
||
Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/Windows-Containers/Main/helpful_tools/Install-DockerCE/install-docker-ce.ps1" -o install-docker-ce.ps1
|
||
.\install-docker-ce.ps1
|
||
```
|
||
|
||
3. Проверяем устнановку docker:
|
||
```
|
||
PS C:\WINDOWS\system32> docker info
|
||
Client:
|
||
Version: 28.2.2
|
||
Context: default
|
||
Debug Mode: false
|
||
|
||
Server:
|
||
Containers: 0
|
||
Running: 0
|
||
Paused: 0
|
||
Stopped: 0
|
||
Images: 0
|
||
Server Version: 28.2.2
|
||
Storage Driver: windowsfilter
|
||
Windows:
|
||
Logging Driver: json-file
|
||
Plugins:
|
||
Volume: local
|
||
Network: ics internal l2bridge l2tunnel nat null overlay private transparent
|
||
Log: awslogs etwlogs fluentd gcplogs gelf json-file local splunk syslog
|
||
CDI spec directories:
|
||
/etc/cdi
|
||
/var/run/cdi
|
||
Swarm: inactive
|
||
Default Isolation: hyperv
|
||
Kernel Version: 10.0 26100 (26100.1.amd64fre.ge_release.240331-1435)
|
||
Operating System: Microsoft Windows Version 24H2 (OS Build 26100.4351)
|
||
OSType: windows
|
||
Architecture: x86_64
|
||
CPUs: 16
|
||
Total Memory: 29.87GiB
|
||
Name: Kubernetes
|
||
ID: c5828016-f9e0-42ab-9b7c-a64742681a38
|
||
Docker Root Dir: C:\ProgramData\docker
|
||
Debug Mode: false
|
||
Experimental: false
|
||
Insecure Registries:
|
||
::1/128
|
||
127.0.0.0/8
|
||
Live Restore Enabled: false
|
||
Product License: Community Engine
|
||
```
|
||
|
||
4. Пуллим [базовые](https://learn.microsoft.com/ru-ru/virtualization/windowscontainers/manage-containers/container-base-images) образы windows:
|
||
```
|
||
docker pull mcr.microsoft.com/windows/servercore:ltsc2025
|
||
docker pull mcr.microsoft.com/windows/servercore:ltsc2022
|
||
docker pull mcr.microsoft.com/windows/servercore:ltsc2019
|
||
```
|
||
|
||
5. Для подготовки базового образа сборка должна быть на `ltsc2019` со следующими параметрами:
|
||
```
|
||
FROM mcr.microsoft.com/windows/servercore:ltsc2019
|
||
|
||
RUN curl -SL --output vs_buildtools.exe https://aka.ms/vs/17/release/vs_buildtools.exe \
|
||
&& (start /w vs_buildtools.exe \
|
||
--quiet --wait --norestart --nocache \
|
||
--installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" \
|
||
--noUpdateInstaller \
|
||
--add Microsoft.Component.MSBuild \
|
||
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \
|
||
--add Microsoft.VisualStudio.Component.VC.DiagnosticTools \
|
||
--add Microsoft.VisualStudio.Component.Windows11SDK.22261 \
|
||
--add Microsoft.VisualStudio.Component.VC.Redist.14.latest \
|
||
--add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core \
|
||
|| IF "%ERRORLEVEL%"=="3010" EXIT 0) \
|
||
&& del /q vs_buildtools.exe
|
||
```
|
||
|
||
6. В случае ошибки по `hcsshim::ImportLayer failed in Win32: The system cannot find the path specified. (0x3)`
|
||
требуется выполнить конфигурацию `dockerd` в `%programdata%\docker\config\daemon.json`
|
||
|
||
Пример:
|
||
```
|
||
{
|
||
"hosts": [
|
||
"npipe://"
|
||
],
|
||
"experimental": false,
|
||
"storage-opts": [
|
||
"size=300GB"
|
||
],
|
||
"data-root": "D:\\docker-root"
|
||
}
|
||
|
||
``` |