먼저 Windows 에서 도커를 사용하기 위해선 WSL2(Windows Subsystem for Linux 2)가 필요하다.
마이크로소프트 스토어에서 Windows Terminal을 다운받는다.

그다음 관리자 권한으로 실행한다.

터미널에 DISM 명령어를 실행한다.
> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl을 입력해보면 아래와같이 linux를 설치하라고 뜬다.

위의 주소를 클릭하고 마이크로소프트 스토어에서 Ubuntu를 검색하여 설치한다.

아래와같이 명령어를 입력하면 잘 되고있는지 확인할 수 있다.

이제는 버전을 2로 바꿔보자. 먼저 버전을 확인해준다.
> wsl -l -v
Name State Version
* Ubuntu Running 1
버전을 바꾸어준다.
> wsl --set-version Ubuntu 2
아래와 같은 에러가 뜬다면 아래 링크에 접속해 다운로드 한다.
https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
WSL 2에 커널 구성 요소 업데이트가 필요합니다. 자세한 내용은 https://aka.ms/wsl2kernel을 참조하십시오.
기본값도 바꾸어준다.
> wsl --set-default-version 2
확인해본다.
> wsl -l -v
Name State Version
* Ubuntu Running 2
이제 WSL2는 세팅이 완료되었다. 도커를 설치해보자
https://hub.docker.com/editions/community/docker-ce-desktop-windows
Docker Desktop for Windows by Docker | Docker Hub
Docker Desktop for Windows Docker Desktop for Windows is Docker designed to run on Windows 10. It is a native Windows application that provides an easy-to-use development environment for building, shipping, and running dockerized apps. Docker Desktop for W
hub.docker.com
추가적으로 WSL2 우분투 터미널에서 docker 명령어를 사용할 수 있다.

'DevOps > Docker' 카테고리의 다른 글
Docker | bash: sudo: command not found (0) | 2021.10.28 |
---|---|
Docker | Windows | Dockerhub (0) | 2021.10.12 |
Docker | Windows | 이미지 상태확인 및 삭제 (0) | 2021.10.12 |
Docker | Windows | 컨테이너 포트 부여 및 이미지화 (0) | 2021.10.12 |
Docker | Windows | 컨테이너 생성/ 종료/ 실행/ 진입 (0) | 2021.10.12 |