VM에 Docker 설치하기

Linux 기반 가상머신(VM)에 도커 설치하는 방법 설명

 


 

설치과정 

 

1. 시스템 업데이트

apt update

 

 

2. 필수 패키지 설치

sudo apt install -y ca-certificates curl gnupg

 

 

3. GPG 키 추가

sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo tee /etc/apt/keyrings/docker.asc > /dev/null
sudo chmod a+r /etc/apt/keyrings/docker.asc

 

 

4. Docker 저장소 추가

echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

 

그리고 패키지 업데이트 한번더

 

5. Docker 설치

sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

 

정상적으로 됐으면 도커 버전 확인

docker --version

 

실행화면

 

6. Docker 서비스 자동 시작 설정

systemctl start docker
systemctl enable docker
sudo systemctl status docker

 

start : 실행 명령어

enable : VM 시작할때 자동 시작 명령어

status : 상태확인 명령어

 

 

아래 명령어를 실행해서 잘 설치되었는지 확인

docker run hello-world

실행화면

 

 

hello-world:latest를 Docker Hub에서 다운로드 안되는 오류가 뜬다면?

 

1. Docker 서비스 실행중인지 확인

 

2. 네트워크 연결 확인

ping -c 4 google.com

 

3. Docker Hub 접속 가능한지 확인

curl -v https://registry-1.docker.io

 

4. Docker 재시작 해보기

'Docker' 카테고리의 다른 글

Docker services 내부 설정 상세 정리  (0) 2025.03.10
Docker Compose  (0) 2025.03.10
Docker Desktop에서 container 실행해보기  (0) 2025.03.10
Window에서 도커 설치  (0) 2025.03.10
Docker란?  (0) 2025.03.10