본문 바로가기

컨테이너/Docker

[도커 강의] (1) 도커 설치 (*리눅스/ *윈도우)

1. Redhat Linux 가상환경에 도커 설치하기


도커에 대한 학습을 하기 이전에 준비할 것은, 

Linux나 Window OS가 필요하다.

우선 Linux에 도커를 설치하는것이 조금 더 쉽고 번거롭지 않기 때문에 

 

linux에 도커 엔진 설치를 해보겠다.

[root@localhost ~] uname -r

> 
3.10.0-1127.19.1.el7.x86_64



[root@localhost ~] yum install -y yum-utils



[root@localhost ~] yum-config-manager \--add-repo \ https://download.docker/com/linux/centos/docker-ce.repo

[root@localhost ~]yum install -y docker-ce

[root@localhost ~]systemctl start docker





[root@localhost ~] docker info

=> 도커 컨테이너, 실행중, 정지된, 이미지 ,버전

 

 

이렇게 하면 도커가 설치된다. 굉장히 간단하다.

하지만 Window에서는 조금 까다롭다

 

2. docker Desktop 설치

docker desktop은 윈도우에 가상환경을 만들어, 그위에 도커를 사용할수 있게 해주는 툴이다.

 

2-1. Docker desktop 다운로드

 - 다음 사이트 접속 > Get Docker 클릭 하여 다운로드

 - https://hub.docker.com/editions/community/docker-ce-desktop-windows/

 

 

2-2. WSL installation

 - 도커실행시 다음과 같은 오류 메세지가 나오는 분들은 해당 링크로 가서 관련 파일을 설치해 준 후 재기동 하면 된다.

 - WSL은 윈도우에 Linux 커널을 사용할수 있게 해주는 기능입니다. 

 

자세히는, WSL은 Windows Subsystem for Linux 2의 줄임말로 윈도우에서 리눅스를 사용할 수 있게 해주는 기능이며, Home 에디션의 경우 Docker를 사용하려면 WSL2가 필수이며, Pro 사용자의 경우 WSL2를 사용하지 않더라도 Hyper-V 기반 가상화를 사용해 Docker Engine을 사용하는 것이 가능합니다.

 

해당 오류 메세지의 https://aka.ms/wsl2kernel 링크에 접속하여 시키는대로 설치하면 됩니다.

 

 

 

3. (Mac) docker 설치


 맥에서 도커를 설치해보자.

 

(1) 도커 설치 

hub.docker.com/editions/community/docker-ce-desktop-mac

 

 

1) 우선 위 사이트에서 "Get Docker" 를 클릭하여 도커 파일을 다운받아 실행한다.

2) 다운받은 파일을 더블클릭하여 실행하고, 어플리케이션 디렉토리로 이동시킨다.

 

 

3) 도커 아이콘을 더블클릭하여 실행을 한번 해준다.

 

위의 팝업이 뜨면 OK 클릭

 

 

3) 여기까지 완료되면, terminal에서 docker --version으로 설치되었는지 확인한다.

 

 

4. Ubuntu Docker 설치

#mzc@tcetest01:~$ 
sudo apt-get update

Hit:1 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:2 http://kr.archive.ubuntu.com/ubuntu focal InRelease
Hit:3 http://kr.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:4 http://kr.archive.ubuntu.com/ubuntu focal-backports InRelease
Reading package lists... Done


#mzc@tcetest01:~$ 
 sudo apt-get install \
 apt-transport-https ca-certificates curl gnupg lsb-release -y

#mzc@tcetest01:~# 
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

#mzc@tcetest01:~# 
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

#mzc@tcetest01:~# 
sudo apt-get update


Get:1 https://download.docker.com/linux/ubuntu focal InRelease [57.7 kB]
Get:2 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages [11.6 kB]
Hit:3 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:4 http://kr.archive.ubuntu.com/ubuntu focal InRelease
Hit:5 http://kr.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:6 http://kr.archive.ubuntu.com/ubuntu focal-backports InRelease
Fetched 69.3 kB in 1s (48.6 kB/s)
Reading package lists... Done


mzc@tcetest01:~$ 
sudo apt-get install docker-ce docker-ce-cli containerd.io -y

mzc@tcetest01:~$ 
sudo systemctl restart docker

mzc@tcetest01:~$ 
sudo systemctl enable docker

Synchronizing state of docker.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable docker

mzc@tcetest01:~$ 
docker --version

Docker version 20.10.9, build c2ea9bc

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

트러블슈팅

https://hello-bryan.tistory.com/159 

 

[Docker] 도커. Window 에 설치하기. 오류해결방법

Windows 10 에 Docker 설치 Windows 10 x64 Pro, Enterprise 또는 Education (빌드 15063 이상) docker hub 사이트에서 다운로드 https://hub.docker.com/editions/community/docker-ce-desktop-windows/ Docker..

hello-bryan.tistory.com