개발환경 세팅하기 (0부터 Docker까지)

고리·2022년 9월 1일
0

팀원 모두가 Window을 사용하는 관계로 이번 프로젝트는 wsl2를 사용한다.

버전
Ubuntu 20.04.4
Docker 20.10.17

WSL2 설치

이 사이트를 참고해 설치를 진행하면 되지만 버전 통일을 위해 같은 방식으로 진행 바람.

필자는 재설치라 명령어에 의한 결과 값이 다를 수 있음.

우선 설정 -> Windows 업데이트에서 최신버전으로 업데이트


powershell을 관리자로 실행한 후 위의 명령어 복사 붙여넣기

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


가상머신 활성화 하기

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


Ubuntu 20.04.4 버전 설치하기

다운로드 후

열기 클릭


github와 동일한 Username설정
비밀번호는 원하는 걸로 설정


code .입력해서 vscode 설치

다들 vscode는 깔려 있겠지?!

sudo apt-get update
sudo apt-get upgrade

위 두 명령어 차례대로 실행

sudo apt-get update && sudo apt-get upgrade

한줄로도 실행 가능

다 끝나면 code .로 vscode실행


wsl확장 설치 이 밖에 필요 확장 설치하라고 나오면 다 OK를 누르자

필자는 작업공간을 따로 만드는 걸 좋아해서 명령어 몇개 추가


Docker 설치 둘 중 택1


Docker 설치(Docker Desktop 사용)

이 사이트에서 Docker Desktop 설치


Download Docker Desktop for Windows 클릭


설치설치


설치완료


쭉쭉


우측 상단에 설정(톱니바퀴 모양) 클릭


Use the WSL 2 based engine체크 확인


Resources -> WSL Integration으로 가서 Ubuntu-20.04체크 후 Apple & Restart 버튼 클릭

docker --version

명령어 입력


출력 확인


WSL 배포 확인

powershell 실행

wsl -l -v
wsl --set-default Ubuntu-20.04

배포 Ubuntu-20.04로 변경


결과 확인


도커 실행 확인


docker run hello-world입력


실행 중인 프로세스에 helow-world 이미지가 있는지 확인


Docker Desktop연결 됐는지 확인


도커 확장 설치


컨테이너 확장 설치

Docker 설치(Docker Engine 사용)

이 사이트를 참고해서 진행하였음

도커 리포지토리 설정

$ sudo apt-get update
$ sudo apt-get install ca-certificates curl gnupg lsb-release
$ sudo mkdir -p /etc/apt/keyrings
$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

위의 명령어 차례대로 실행

도커 엔진 설치

$ sudo apt-get update
$ sudo apt-get install docker-ce=5:20.10.17~3-0~ubuntu-focal
$ sudo apt-get install docker-ce-cli=5:20.10.17~3-0~ubuntu-focal
$ sudo apt-get install containerd.io=1.6.8-1
$ sudo apt-get install docker-compose-plugin=2.6.0~ubuntu-focal

위의 명령어 차례대로 실행
트러블 슈팅을 위해 팀원간 버전을 맞췄다.

$ sudo service docker start
$ sudo docker run hello-world

여기까지!

profile
Back-End Developer

0개의 댓글