Microsoft MVP성태의 닷넷 이야기
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 
(연관된 글이 1개 있습니다.)

Windows Server 2022 + docker desktop 설치 시 WSL 2로 선택한 경우 "Failed to deploy distro docker-desktop to ..." 오류 발생

현재 버전의 Windows Server 2022는 10.0.20348 버전이므로 이 글에서 설명한 오류가 발생하지 않습니다. 만약 발생한다면 윈도우 업데이트를 통해 20348 버전을 설치해야 합니다.




Docker desktop을 Windows Server 2022에서 설치하면 이렇게 떡 하니,

docker_desktop_wsl2_2022_1.png

"WSL 2"를 지원하는 플랫폼이라고 나오면서 "Enable WSL 2" 버튼을 어서 눌러 달라는 듯이 창을 띄워줍니다. 그래서 버튼을 눌렀더니 이후 "Failed to deploy distro docker-desktop to ..."라는 오류 메시지가 발생합니다.

System.InvalidOperationException:
Failed to deploy distro docker-desktop to %USERPROFILE%\AppData\Local\Docker\wsl\distro: exit code: -1
 stdout: Copyright (c) Microsoft Corporation. All rights reserved.

...[생략]...

 stderr: 
   at Docker.ApiServices.WSL2.WslShortLivedCommandResult.LogAndThrowIfUnexpectedExitCode(String prefix, ILogger log, Int32 expectedExitCode) in C:\workspaces\PR-16841\src\github.com\docker\pinata\win\src\Docker.ApiServices\WSL2\WslCommand.cs:line 146
   at Docker.Engines.WSL2.WSL2Provisioning.<DeployDistroAsync>d__17.MoveNext() in C:\workspaces\PR-16841\src\github.com\docker\pinata\win\src\Docker.Engines\WSL2\WSL2Provisioning.cs:line 168
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Docker.Engines.WSL2.WSL2Provisioning.<ProvisionAsync>d__8.MoveNext() in C:\workspaces\PR-16841\src\github.com\docker\pinata\win\src\Docker.Engines\WSL2\WSL2Provisioning.cs:line 77
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Docker.Engines.WSL2.LinuxWSL2Engine.<DoStartAsync>d__28.MoveNext() in C:\workspaces\PR-16841\src\github.com\docker\pinata\win\src\Docker.Engines\WSL2\LinuxWSL2Engine.cs:line 179
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Docker.ApiServices.StateMachines.TaskExtensions.<WrapAsyncInCancellationException>d__0.MoveNext() in C:\workspaces\PR-16841\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\TaskExtensions.cs:line 29
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Docker.ApiServices.StateMachines.StartTransition.<DoRunAsync>d__5.MoveNext() in C:\workspaces\PR-16841\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\StartTransition.cs:line 67
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Docker.ApiServices.StateMachines.StartTransition.<DoRunAsync>d__5.MoveNext() in C:\workspaces\PR-16841\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\StartTransition.cs:line 92
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Docker.ApiServices.StateMachines.EngineStateMachine.<StartAsync>d__14.MoveNext() in C:\workspaces\PR-16841\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\EngineStateMachine.cs:line 69
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Docker.Engines.Engines.<RestartAsync>d__26.MoveNext() in C:\workspaces\PR-16841\src\github.com\docker\pinata\win\src\Docker.Engines\Engines.cs:line 265

wsl.exe를 실행해 docker-desktop을 설치하려고 시도했던 것 같은데, 결정적으로 그 명령어가 뭐였는지에 대한 정보가 없습니다.

어쩔 수 없이 sysmon을 이용해,

실행된 프로세스(EXE)의 명령행 인자를 확인하고 싶다면 - Sysmon
; https://www.sysnet.pe.kr/2/0/1771

확인한 결과 다음의 명령어였습니다.

Process Create:
...[생략]...
IntegrityLevel: Medium
Hashes: SHA1=667C43C37E61ACFEB248C8D263B38789B50C0F0C
ParentProcessGuid: {2732301c-ab0b-61ba-d511-000000000200}
ParentProcessId: 5308
ParentImage: C:\Windows\System32\wsl.exe
ParentCommandLine: "C:\WINDOWS\system32\wsl.exe" --import docker-desktop "%USERPROFILE%\AppData\Local\Docker\wsl\distro" "C:\Program Files\Docker\Docker\resources\wsl\wsl-bootstrap.tar" --version 2

실제로 저렇게 명령어를 실행해 보면 정상적인 출력을 보이지 않습니다. 약간의 시행착오를 거치면 "--version 2"라는 옵션이 문제라는 것을 알 수 있는데요, 그래서 일단 저 옵션을 빼고 실행하면 다음과 같이 잘 됩니다.

c:\temp> wsl.exe --import docker-desktop "%USERPROFILE%\AppData\Local\Docker\wsl\distro" "C:\Program Files\Docker\Docker\resources\wsl\wsl-bootstrap.tar"

c:\temp> wsl --list -v
  NAME              STATE           VERSION
* docker-desktop    Stopped         1

VERSION이 1이라고 되어 있으니 이 부분만 2로 설정되도록 다시 명령을 내려야 하는데,

c:\temp> wsl --set-version docker-desktop 2

이게 문제입니다. 실행해 보면, 결과가 "wsl --help" 화면이 나옵니다. 즉, 해당 명령어의 해석을 지원하지 않는 것입니다. 그렇다고 해서 --set-version 옵션이 아예 누락된 것은 아닌 듯합니다. 왜냐하면 다음과 같이 명령을 내리면,

c:\temp> wsl --set-version docker-desktop
A version number could not be parsed.

버전이 지정되지 않았다고 뜨기 때문입니다. 희한하군요, 이와 마찬가지로 기본 버전도 지정이 안 됩니다.

c:\temp> wsl --set-default-version 2

위의 실행 결과 역시 단순히 "wsl --help" 결과가 나옵니다.




그러다가 우연히 "--status" 옵션을 줬더니,

c:\temp> wsl --status
Default Distribution: docker-desktop
Default Version: 1

WSL automatic updates are on.

The WSL 2 kernel file is not found. To update or restore the kernel please run 'wsl.exe --update'.

c:\temp> wsl --update
Checking for updates...
No updates are available.
The WSL 2 kernel file is not found and may need to be reinstalled or repaired manually.
For more information please visit https://aka.ms/wsl2kernel.

왠지 희망이 보입니다. ^^ 하지만 "wsl.exe --update"로는 안 되는 것 같고, 할 수 없이 웹 사이트를 방문해,

Step 4 - Download the Linux kernel update package
; https://docs.microsoft.com/en-us/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package

아래의 구성 요소를 다운로드해 설치했습니다.

WSL2 Linux kernel update package for x64 machines
; https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi

잘 반영이 되었는지 --status 옵션으로 다시 실행해 보면,

c:\temp> wsl --status
Default Distribution: docker-desktop
Default Version: 1

Windows Subsystem for Linux was last updated on 2021-12-16
WSL automatic updates are on.

Kernel version: 5.10.16

뭔가 느낌이 좋지만, ^^; 여전히 --set-version, --set-default-version 명령어는 먹히지 않습니다.




재미있는 건, 버전을 1로 했을 때는 잘 실행이 된다는 점입니다.

c:\temp> wsl --set-default-version 1
The operation completed successfully.

c:\temp> wsl --set-version docker-desktop 1
Conversion in progress, this may take a few minutes...
No such interface supported

그러니까, 분명히 지금 Windows Server 2022의 WSL 버전이 1로 동작하고 있는 것입니다. 음... 깜빡 속았군요, 결국 docker desktop은 현재 환경이 WSL 2를 지원하는지 단순히 윈도우의 버전으로 확인한 것에 불과한 것입니다.

게다가 검색해 보면, Windows Server 2019부터 preview 빌드에 WSL 2를 지원한다는 글들이 있어서,

How to Install WSL 2 on Windows Server
; https://www.thomasmaurer.ch/2019/08/how-to-install-wsl-2-on-windows-server/

프리뷰 빌드 기준으로 18945 버전부터 지원했으니, 당연히 2022는 20348이므로 지원을 할 거라고 생각했지만 오산이었습니다.

결론은, Windows Server 2022는 WSL 2를 아직 지원하지 않습니다.




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]

[연관 글]






[최초 등록일: ]
[최종 수정일: 11/3/2022]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




1  2  3  4  5  6  [7]  8  9  10  11  12  13  14  15  ...
NoWriterDateCnt.TitleFile(s)
13446정성태11/16/20232416닷넷: 2161. .NET Conf 2023 - Day 1 Blazor 개요 정리
13445정성태11/15/20232679Linux: 62. 리눅스/WSL에서 CA 인증서를 저장하는 방법
13444정성태11/15/20232439닷넷: 2160. C# 12 - Experimental 특성 지원
13443정성태11/14/20232488개발 환경 구성: 687. OpenSSL로 생성한 사용자 인증서를 ASP.NET Core 웹 사이트에 적용하는 방법
13442정성태11/13/20232304개발 환경 구성: 686. 비주얼 스튜디오로 실행한 ASP.NET Core 사이트를 WSL 2 인스턴스에서 https로 접속하는 방법
13441정성태11/12/20232644닷넷: 2159. C# - ASP.NET Core 프로젝트에서 서버 Socket을 직접 생성하는 방법파일 다운로드1
13440정성태11/11/20232349Windows: 253. 소켓 Listen 시 방화벽의 Public/Private 제어 기능이 비활성화된 경우
13439정성태11/10/20232835닷넷: 2158. C# - 소켓 포트를 미리 시스템에 등록/예약해 사용하는 방법(Port Exclusion Ranges)파일 다운로드1
13438정성태11/9/20232444닷넷: 2157. C# - WinRT 기능을 이용해 윈도우에서 실행 중인 Media App 제어
13437정성태11/8/20232638닷넷: 2156. .NET 7 이상의 콘솔 프로그램을 (dockerfile 없이) 로컬 docker에 배포하는 방법
13436정성태11/7/20232861닷넷: 2155. C# - .NET 8 런타임부터 (Reflection 없이) 특성을 이용해 public이 아닌 멤버 호출 가능
13435정성태11/6/20232794닷넷: 2154. C# - 네이티브 자원을 포함한 관리 개체(예: 스레드)의 GC 정리
13434정성태11/1/20232606스크립트: 62. 파이썬 - class의 정적 함수를 동적으로 교체
13433정성태11/1/20232340스크립트: 61. 파이썬 - 함수 오버로딩 미지원
13432정성태10/31/20232370오류 유형: 878. 탐색기의 WSL 디렉터리 접근 시 "Attempt to access invalid address." 오류 발생
13431정성태10/31/20232695스크립트: 60. 파이썬 - 비동기 FastAPI 앱을 gunicorn으로 호스팅
13430정성태10/30/20232596닷넷: 2153. C# - 사용자가 빌드한 ICU dll 파일을 사용하는 방법
13429정성태10/27/20232849닷넷: 2152. Win32 Interop - C/C++ DLL로부터 이중 포인터 버퍼를 C#으로 받는 예제파일 다운로드1
13428정성태10/25/20232896닷넷: 2151. C# 12 - ref readonly 매개변수
13427정성태10/18/20233079닷넷: 2150. C# 12 - 정적 문맥에서 인스턴스 멤버에 대한 nameof 접근 허용(Allow nameof to always access instance members from static context)
13426정성태10/13/20233258스크립트: 59. 파이썬 - 비동기 호출 함수(run_until_complete, run_in_executor, create_task, run_in_threadpool)
13425정성태10/11/20233084닷넷: 2149. C# - PLinq의 Partitioner<T>를 이용한 사용자 정의 분할파일 다운로드1
13423정성태10/6/20233059스크립트: 58. 파이썬 - async/await 기본 사용법
13422정성태10/5/20233199닷넷: 2148. C# - async 유무에 따른 awaitable 메서드의 병렬 및 예외 처리
13421정성태10/4/20233237닷넷: 2147. C# - 비동기 메서드의 async 예약어 유무에 따른 차이
13420정성태9/26/20235242스크립트: 57. 파이썬 - UnboundLocalError: cannot access local variable '...' where it is not associated with a value
1  2  3  4  5  6  [7]  8  9  10  11  12  13  14  15  ...