failed to register layer: re-exec error: exit status 1: output: hcsshim::ImportLayer failed in Win32: Operation did not complete successfully because the file contains a virus or potentially unwanted software. (0xe1) UnrealEngine\Engine\Extras\Containers\Dockerfiles\windows>pause
手順に沿ってトライするがウィルス?が検出されるみたいで失敗する
プルするWindowsServerの問題?どうすりゃいいんだろ?解決したんで今は大丈夫ってあるけど….
こっちでは一時間ウィルスの検出を無効にしてプルできたって!やってみる?
Sending build context to Docker daemon 11.78kB
Step 1/14 : ARG DLL_IMAGE
Step 2/14 : ARG BASETAG
Step 3/14 : FROM ${DLL_IMAGE}:${BASETAG} AS full
ltsc2022: Pulling from windows/server
01c4baad83ab: Pull complete
72deb71b01a9: Extracting [==================================================>] 1.59GB/1.59GB
failed to register layer: re-exec error: exit status 1: output: hcsshim::ImportLayer failed in Win32: Operation did not complete successfully because the file contains a virus or potentially unwanted software. (0xe1)
続行するには何かキーを押してください . . .
まあ、一旦例外にプルするサイトを登録してみるが、うまくいかない
BBSにあったように一旦Avastウィルスシールドを一時間無効にしてみた
が、しかしエラー
Sending build context to Docker daemon 11.78kB
Step 1/14 : ARG DLL_IMAGE
Step 2/14 : ARG BASETAG
Step 3/14 : FROM ${DLL_IMAGE}:${BASETAG} AS full
ltsc2022: Pulling from windows/server
01c4baad83ab: Pull complete
72deb71b01a9: Pull complete
Digest: sha256:88f91718744f0fc806d63d36876ac411dfec8d4baaf397a284c1acb138c71fbf
Status: Downloaded newer image for mcr.microsoft.com/windows/server:ltsc2022
—> 4dc11d7a162c
Step 4/14 : ARG VERSION_SPECIFIC_DLLS
—> Running in ad17502bba8f
—> Removed intermediate container ad17502bba8f
—> 9250c015ada9
Step 5/14 : RUN xcopy /y C:\Windows\System32\avicap32.dll C:\GatheredDlls\ && xcopy /y C:\Windows\System32\avifil32.dll C:\GatheredDlls\ && xcopy /y C:\Windows\System32\avrt.dll C:\GatheredDlls\ && xcopy /y C:\Windows\System32\d3d10warp.dll C:\GatheredDlls\ && xcopy /y C:\Windows\System32\D3DSCache.dll C:\GatheredDlls\ && xcopy /y C:\Windows\System32\dsound.dll C:\GatheredDlls\ && xcopy /y C:\Windows\System32\dxva2.dll C:\GatheredDlls\ && xcopy /y C:\Windows\System32\glu32.dll C:\GatheredDlls\ && xcopy /y C:\Windows\System32\InputHost.dll C:\GatheredDlls\ && xcopy /y C:\Windows\System32\mf.dll C:\GatheredDlls\ && xcopy /y C:\Windows\System32\mfcore.dll C:\GatheredDlls\ && xcopy /y C:\Windows\System32\mfplat.dll C:\GatheredDlls\ && xcopy /y C:\Windows\System32\mfplay.dll C:\GatheredDlls\ && xcopy /y C:\Windows\System32\mfreadwrite.dll C:\GatheredDlls\ && xcopy /y C:\Windows\System32\msacm32.dll C:\GatheredDlls\ && xcopy /y C:\Windows\System32\msdmo.dll C:\GatheredDlls\ && xcopy /y C:\Windows\System32\msvfw32.dll C:\GatheredDlls\ && xcopy /y C:\Windows\System32\opengl32.dll C:\GatheredDlls\ && xcopy /y C:\Windows\System32\ResampleDMO.dll C:\GatheredDlls\ && xcopy /y C:\Windows\System32\ResourcePolicyClient.dll C:\GatheredDlls\ && xcopy /y C:\Windows\System32\XInput1_4.dll C:\GatheredDlls\ && powershell -Command “$dlls = $env:VERSION_SPECIFIC_DLLS; if ($dlls) {foreach ($dll in $dlls.Split(‘;’)) { & xcopy /y C:\Windows\System32\$dll C:\GatheredDlls\ } }”
—> Running in 433c38feaf56
container 433c38feaf5624b2a4c86e9551624b603368cdbca6448af7c666696c583205db encountered an error during hcs::System::Start: failure in a Windows system call: The virtual machine or container exited unexpectedly. (0xc0370106)
続行するには何かキーを押してください . . .
コンテナとWindows11の互換性の問題?で起動できないのか?
Pullはできているみたいimageがある。もうちょっと調べてみるか。
pullしたイメージはltsc2022のようだが、他に2019と2025がある様子。2022でエラーるから2025を試してみる
2025っだとpullできない。バージョンは2022であっているみたい。ほかの問題か?
とりあえずイメージが使えるのかプルしたイメージを使ってみる
REPOSITORY TAG IMAGE ID CREATED SIZE
7ea5cb8972f6 18 hours ago 10.5GB
mcr.microsoft.com/windows/server ltsc2022 4dc11d7a162c 5 weeks ago 10.5GBPS
Microsoft Windows [Version 10.0.20348.2966]
(c) Microsoft Corporation. All rights reserved.
C:\>echo “hello world?” > hello.txt
C:\>dir
Volume in drive C has no label.
Volume Serial Number is A616-FDC1Directory of C:\01/10/2025 09:27 AM 17 hello.txt
09/06/2024 08:56 AM 5,647 License.txt
12/05/2024 10:50 AM<dir>Program Files
12/05/2024 10:40 AM<dir>Program Files (x86)
12/05/2024 10:47 AM<dir>Users
01/10/2025 09:26 AM<dir>Windows
2 File(s) 5,664 bytes
4 Dir(s) 136,106,790,912 bytes freeC:\>type hello.txt
“hello world?”C:\>type License.txt
The following license can be found online at https://aka.ms/ContainerLicenseMICROSOFT SOFTWARE SUPPLEMENTAL LICENSE
FOR WINDOWS CONTAINER BASE IMAGEThis Supplemental License is for the Windows Container Base Image (“Container Image”). If you comply with the terms of this Supplemental License you may use the Container Image as described below.The Container Image may only be used with a validly licensed copy of:
Windows Server Standard or Windows Server Datacenter software (collectively “Server Host Software”), or Microsoft Windows Operating System (version 10) software (“Client Host Software”), or Windows 10 IoT Enterprise and Windows 10 IoT Core (collectively “IoT Host Software”). The Server Host Software, Client Host Software, and IoT Host Software are collectively referred to as the “Host Software” and a license for Host Software is a “Host License”.You may not use the Container Image if you do not have a corresponding version and edition of the Host License. Certain restrictions and additional terms may apply, which are described herein. If licensing terms herein conflict with Host License, then this Supplemental License shall govern with respect to the Container Image. BY ACCEPTING THIS SUPPLEMENTAL LICENSE OR USING THE CONTAINER IMAGE, YOU AGREE TO ALL OF THESE TERMS. IF YOU DO NOT ACCEPT AND COMPLY WITH THESE TERMS, YOU MAY NOT USE THE CONTAINER IMAGE.DEFINITIONS
Windows Server Container (without Hyper-V isolation) is a feature of Microsoft Windows Server software.
Windows Server Container with Hyper-V isolation.[0] Section 2(k) of the Microsoft Windows Server (version 10) license terms is hereby deleted in its entirety and replaced with the revised terms as shown in “UPDATED” below.
UPDATED: Windows Server Container with Hyper-V isolation (formerly known as Hyper-V Container) is a container technology in Windows Server which utilizes a virtual operating system environment to host one or more Windows Server Container(s). Each Hyper-V isolation instance used to host one or more Windows Server Container(s) is considered one virtual operating system environment.
LICENSE TERMS
Host License. The Host License terms apply to your use of the Container Image and any Windows container(s) created with the Container Image which are distinct and separate from a virtual machine.
Use Rights. The Container Image may be used to create an isolated virtualized Windows operating system environment to which primary and significant functionality is added (“Consolidated Image”). You may (1) use the Container Image to create, build, and run your Consolidated Image on Host Software and (2) distribute the Container Image only as part of your Consolidated Image. Updates to the Host Software may not update the Container Image so you may re-create any Windows containers based on an updated Container Image.
Restrictions. You may not remove this Supplemental License document file from the Container Image. You may not enable remote access to the application(s) you run within your container to avoid applicable license fees. You may not reverse engineer, decompile, or disassemble the Container Image, or attempt to do so, except and only to the extent required by third party licensing terms governing the use of certain open-source components that may be included with the software. Additional restrictions in the Host License may apply.
ADDITIONAL TERMS
Client Host Software. When running a Container Image on Client Host Software you may run any number of the Container Image instantiated as Windows containers for test or development purposes only. You may not use these Windows containers in a production environment on Client Host Software.
IoT Host Software. When running a Container Image on IoT Host Software you may run any number of the Container Image instantiated as Windows containers for test or development purposes only. You may only use the Container Image in a production environment if you have agreed to the Microsoft Commercial Terms of Use for Windows 10 Core Runtime Images or the Windows 10 IoT Enterprise Device License (“Windows IoT Commercial Agreement”). Additional terms and restrictions in the Windows IoT Commercial Agreements apply to your use of Container Image in a production environment.
Third Party Software. The Container Image may include third party applications that are licensed to you under this Supplemental License or under their own terms. License terms, notices, and acknowledgements, if any, for the third-party applications may be accessible online at https://aka.ms/thirdpartynotices or in an accompanyin
Open Source Components. The Container Image may contain third party copyrighted software licensed under open source licenses with source code availability obligations. Copies of those licenses are included in the Third Party Notices file or other accompanying notices file. You may obtain the complete corresponding source code from Microsoft if and as required under the relevant open source license by sending a money order or check for $5.00 to: Source Code Compliance Team, Microsoft Corporation, 1 Microsoft Way, Redmond, WA 98052, USA. Please include the name “Microsoft Software Supplemental License for Windows Container base image”, the open source component name and version number in the memo line of your payment. You may also find a copy of the source at https://aka.ms/getsource.
問題なく使えてるがLicenseを見るとwindows10みたいなのだがこれが問題なのか?でも公開されているBASEIMAGEはすべて10のようだ。Serverは10しかない?
てっきり10に11のdllをコピーしているのが原因かと思ったが…
とりあえずBASEIMAGEを起動してどこまで処理できるか確認してみる
curl --progress-bar -L "https://download.microsoft.com/download/8/4/A/84A35BF1-DAFE-4AE8-82AF-AD2AE20B6B14/directx_Jun2010_redist.exe" --output %TEMP%\directx_redist.exe url: (6) Could not resolve host: download.microsoft.com
どうもここでエラーるみたい。ちなみに
curl https://download.microsoft.com url: (6) Could not resolve host: download.microsoft.com
同じ結果。
どうやらWinコンテナからSSL接続ができない模様。
コンテナから
C:\>curl http://download.microsoft.com/download/8/4/A/84A35BF1-DAFE-4AE8-82AF-AD2AE20B6B14/directx_Jun2010_redist.exe curl: (6) Could not resolve host: download.microsoft.com C:\>curl https://plusload.net curl: (6) Could not resolve host: plusload.net
WindowsCMDから
Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. 新機能と改善のために最新の PowerShell をインストールしてください!https://aka.ms/PSWindows PS C:\Users\User> curl https://plusload.net StatusCode : 200 StatusDescription : OK Content : ; rel="https://api.w.org/" Content-Type: text/html; charset=UTF-8 Date: Fri, 1... Forms : {} Headers : {[Transfer-Encoding, chunked], [Connection, keep-alive], [Link, <https://plusload.net/index.php?res t_route=/>; rel="https://api.w.org/"], [Content-Type, text/html; charset=UTF-8]...} Images : {@{innerHTML=; innerText=; outerHTML=; outerText=; tagName=IMG; alt=; src=https://plusload.net/wp- content/uploads/2023/08/1170399.jpg; width=1170; height=399}} InputFields : {} Links : {@{innerHTML=コンテンツへスキップ; innerText=コンテンツへスキップ; outerHTML=コンテンツへスキップ; outerText=コンテンツへスキップ; tagName =A; class=skip-link screen-reader-text; href=#content}, @{innerHTML=ue5…; innerText=ue5…; outerHT ML=ue5…; outerText=ue5…; tagName=A; title=2025年1月8日; href=https://plusload.net/?p=1322}, @{innerHTML=Doc…; innerText=Doc…; outerH TML=Doc…; outerText=Doc…; tagName=A ; title=2025年1月7日; href=https://plusload.net/?p=1316}, @{innerHTML=Doc…; innerText=Doc…; outer HTML=Doc…; outerText=Doc…; tagNam e=A; title=2024年12月24日; href=https://plusload.net/?p=1298}...} ParsedHtml : mshtml.HTMLDocumentClass RawContentLength : 49290 PS C:\Users\User> curl https://download.microsoft.com/download/8/4/A/84A35BF1-DAFE-4AE8-82AF-AD2AE20B6B14/directx_Jun2010_redist.exe StatusCode : 200 StatusDescription : OK Content : {77, 90, 144, 0...} RawContent : HTTP/1.1 200 OK X-Ms-ApiVersion: Distribute 1.2 X-Ms-Region: prod-neu-z1 Content-Disposition: attachment; filename=directx_Jun2010_redist.exe; filename*=UTF-8''directx_Jun2 010_redist.exe Connectio... Headers : {[X-Ms-ApiVersion, Distribute 1.2], [X-Ms-Region, prod-neu-z1], [Content-Disposition, attachment; f ilename=directx_Jun2010_redist.exe; filename*=UTF-8''directx_Jun2010_redist.exe], [Connection, keep -alive]...} RawContentLength : 100275120
コンテナからDNS解決ができないようなのでローカルIPでの接続は確認できた。のでこれは一旦DLしたのをローカルにおいてみるか?
…と考えたが運用に支障があるので根本的な解決にならないのでDockerのエンジンの問題でこれにDNSの機能がないのではないかと考えた。
調べてみるとWindowsコンテナ自体のものではないが、WSLでのDockerDisktopに同様の問題があり、この様な解決方法があるのを見つけた。
おお!これでDNSの解決はできた!
なのでDockerfileのRUN部分をプルしたコンテナ内で実行して準備しておき実行済みのRUN部分はコメントアウトしておく
まずmcr.microsoft.com/windows/server:ltsc2022をpullしてDockerfileのコマンドを実行してopイメージを作成してpushしておく(以下のように)
次にmcr.microsoft.com/windows/servercore:ltsc2022もpullしてコマンドを実行してop2イメージを作成してpushしておく(以下のように)
準備が済んだら残りのバッチコマンドをバッチファイルを叩いて実行する
# escape=` ARG DLL_IMAGE ARG BASETAG FROM ${DLL_IMAGE}:${BASETAG} AS full ARG VERSION_SPECIFIC_DLLS # Gather the system DLLs that we need from the full Windows base image #RUN xcopy /y C:\Windows\System32\avicap32.dll C:\GatheredDlls\ && ` # xcopy /y C:\Windows\System32\avifil32.dll C:\GatheredDlls\ && ` # xcopy /y C:\Windows\System32\avrt.dll C:\GatheredDlls\ && ` # xcopy /y C:\Windows\System32\d3d10warp.dll C:\GatheredDlls\ && ` # xcopy /y C:\Windows\System32\D3DSCache.dll C:\GatheredDlls\ && ` # xcopy /y C:\Windows\System32\dsound.dll C:\GatheredDlls\ && ` # xcopy /y C:\Windows\System32\dxva2.dll C:\GatheredDlls\ && ` # xcopy /y C:\Windows\System32\glu32.dll C:\GatheredDlls\ && ` # xcopy /y C:\Windows\System32\InputHost.dll C:\GatheredDlls\ && ` # xcopy /y C:\Windows\System32\mf.dll C:\GatheredDlls\ && ` # xcopy /y C:\Windows\System32\mfcore.dll C:\GatheredDlls\ && ` # xcopy /y C:\Windows\System32\mfplat.dll C:\GatheredDlls\ && ` # xcopy /y C:\Windows\System32\mfplay.dll C:\GatheredDlls\ && ` # xcopy /y C:\Windows\System32\mfreadwrite.dll C:\GatheredDlls\ && ` # xcopy /y C:\Windows\System32\msacm32.dll C:\GatheredDlls\ && ` # xcopy /y C:\Windows\System32\msdmo.dll C:\GatheredDlls\ && ` # xcopy /y C:\Windows\System32\msvfw32.dll C:\GatheredDlls\ && ` # xcopy /y C:\Windows\System32\opengl32.dll C:\GatheredDlls\ && ` # xcopy /y C:\Windows\System32\RESAMPLEDMO.dll C:\GatheredDlls\ && ` # xcopy /y C:\Windows\System32\ResourcePolicyClient.dll C:\GatheredDlls\ && ` # xcopy /y C:\Windows\System32\XInput1_4.dll C:\GatheredDlls\ && ` # powershell -Command "$dlls = $env:VERSION_SPECIFIC_DLLS; if ($dlls) {foreach ($dll in $dlls.Split(';')) { & xcopy /y C:\Windows\System32\$dll C:\GatheredDlls\ } }" # Retrieve the DirectX runtime files required by the Unreal Engine, since even the full Windows base image does not include them # non name server access, command error #RUN curl --progress-bar -L "https://download.microsoft.com/download/8/4/A/84A35BF1-DAFE-4AE8-82AF-AD2AE20B6B14/directx_Jun2010_redist.exe" --output %TEMP%\directx_redist.exe && ` # start /wait %TEMP%\directx_redist.exe /Q /T:%TEMP%\DirectX && ` # expand %TEMP%\DirectX\APR2007_xinput_x64.cab -F:xinput1_3.dll C:\GatheredDlls\ && ` # expand %TEMP%\DirectX\Feb2010_X3DAudio_x64.cab -F:X3DAudio1_7.dll C:\GatheredDlls\ && ` # expand %TEMP%\DirectX\Jun2010_D3DCompiler_43_x64.cab -F:D3DCompiler_43.dll C:\GatheredDlls\ && ` # expand %TEMP%\DirectX\Jun2010_XAudio_x64.cab -F:XAudio2_7.dll C:\GatheredDlls\ && ` # expand %TEMP%\DirectX\Jun2010_XAudio_x64.cab -F:XAPOFX1_5.dll C:\GatheredDlls\ # Retrieve the DirectX shader compiler files needed for DirectX Raytracing (DXR) #RUN curl --progress-bar -L "https://github.com/microsoft/DirectXShaderCompiler/releases/download/v1.6.2104/dxc_2021_04-20.zip" --output %TEMP%\dxc.zip && ` # powershell -Command "Expand-Archive -Path \"$env:TEMP\dxc.zip\" -DestinationPath $env:TEMP" && ` # xcopy /y %TEMP%\bin\x64\dxcompiler.dll C:\GatheredDlls\ && ` # xcopy /y %TEMP%\bin\x64\dxil.dll C:\GatheredDlls\ # Copy the required DLLs from the full Windows base image into a smaller Windows Server Core base image ARG BASETAG #FROM mcr.microsoft.com/windows/servercore:${BASETAG} FROM mcr.microsoft.com/windows/servercore:ltsc2022op2 #COPY --from=full C:\GatheredDlls\ C:\Windows\System32\ # Install the Visual C++ runtime files using Chocolatey #RUN powershell -NoProfile -ExecutionPolicy Bypass -Command "$env:chocolateyVersion = '1.4.0'; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" #RUN @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" #RUN choco install -y vcredist-all # Copy our entrypoint script for enabling vendor-specific graphics APIs COPY entrypoint.cmd C:\entrypoint.cmd COPY enable-graphics-apis.ps1 C:\enable-graphics-apis.ps1 # When running containers based on this image, be sure to specify the following flags for the `docker run` command to enable GPU acceleration: # --isolation process --device class/5B45201D-F2F2-4F3B-85BB-30FF1F953599 # (For more information, see: <https://docs.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/gpu-acceleration>)
専用イメージが作成された!
build.batの問題点まとめ
- WindowsServerイメージがpullできない(ウィルス検知される)ので検知をいったん止める
- そのまま叩いてもDockerfileのcurl個所の名前解決ができなくて終了してしまう
- なのでDockerEngineにDNSを追加する必要がある
- また、DockerfileのRUNコマンドがタイミングの問題なのか途中でエラーる
- なのでDockerfileでpullさせて処理するのではなくあらかじめイメージを個別にpullしてコマンドを実行する
- Servercoreが管理者でchocoが実行できないので実行できる環境に手を加える必要がある
- 以上の手順でbuild.batを作り直して実行すると漸くビルドできる