HEROJOON 블로그(히로블)

windows 11에 docker 설치하기 (wsl2 이슈 해결) 본문

Docker

windows 11에 docker 설치하기 (wsl2 이슈 해결)

herojoon 2022. 3. 26. 02:21
반응형

0.요약

  • 저의 설치 환경: Windows 11

1) windows에 docker를 설치합니다.

2) windows10, 11에서 docker를 사용하려면 wsl2로 업데이트가 필요하고, ubuntu를 설치해야 한대서 함께 설치합니다.

3) windows에 설치한 docker를 switch 후 사용합니다.

 

1. windows에 docker 설치하기

 

Install Docker Desktop on Windows

 

docs.docker.com

 

Docker Desktop for Windows 버튼을 클릭하여 설치파일을 다운로드 합니다.

docker 설치가 완료되면 컴퓨터 재부팅이 필요합니다.

 

 

- docker 설치 확인 -

cmd창을 열어서 docker를 입력해줍니다.

docker 관련 명령어 설명들이 표시되면 설치가 정상적으로 된 것입니다.

 

설치는 정상적으로 되었지만 docker를 사용하려면 에러가 발생하면서 사용되지 않습니다.

# 발생 Error
error during connect: In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.:

windows에 설치된 docker hub에서도 docker desktop stopped... 라는 메시지가 출력됩니다.

 

2. windows wsl2로 업데이트하기

windows에서 powerShell을 검색하여 관리자로 실행해줍니다.

 

wsl2 설치 참고 링크에 접속하여 가이드대로 powerShell에 명령어를 입력해줍니다. (wsl2 업데이트 및 ubuntu 설치)

아래 명령어를 복사하여 powerShell에서 실행시켜줍니다.

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

 

필요시 아래 링크를 클릭하여 업데이트 해줍니다.

 

아래 명령어를 복사하여 powerShell에서 실행시켜줍니다.

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

 

아래 링크를 클릭하여 업데이트 해줍니다.

 

아래 명령어를 복사하여 powerShell에서 실행시켜줍니다.

wsl --set-default-version 2

 

linux 설치의 경우는 powerShell에 아래 명령어를 입력하여 설치하였습니다.

# powerShell은 관리자 권한으로 실행합니다.
# 명령어를 실행하여 linux 배포판을 골라줍니다.
wsl --list --online

# 위에서 고른 linux 배포판을 아래 명령어로 설치해줍니다.
# wsl --install -d [배포판이름]
ex)
wsl --install -d Ubuntu-20.04

 

3. windows에 설치한 docker를 switch 설정하기

 

Switch to Linux containers... 를 클릭합니다.

 

windows에 설치된 docker hub에 Docker Desktop starting... 라는 문구가 출력됩니다.

 

아래 화면처럼 정상적으로 Docker Hub가 실행되며, cmd창에서도 docker 명령어를 정상적으로 사용할 수 있습니다.

 

!! Ubuntu 설치 시 아래 에러가 발생했다면 wsl2 업데이트 중 위 4단계를 다시 정상적으로 업데이트 해주시면 됩니다.

# Ubuntu 설치 시 에러
Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x800701bc
Error: 0x800701bc WSL 2? ?? ?? ?? ????? ?????. ??? ??? https://aka.ms/wsl2kernel? ??????.
반응형

'Docker' 카테고리의 다른 글

docker container 로그 확인하기  (0) 2022.04.09
docker container 조회 / 종료하기  (0) 2022.04.07
Comments