블로그로 돌아가기
1월 13, 2026가이드

Linux 서버에 Docker를 설치하는 방법

컨테이너화된 애플리케이션을 위해 Ubuntu 및 CentOS 서버에 Docker 및 Docker Compose를 설치하는 전체 가이드.

Linux 서버에 Docker를 설치하는 방법

Docker는 컨테이너에서 애플리케이션을 개발, 배송 및 실행하기 위한 플랫폼입니다. 컨테이너를 사용하면 애플리케이션을 모든 종속성과 함께 패키징하여 서로 다른 환경에서도 일관되게 작동하도록 보장할 수 있습니다. 이 가이드는 Hiddence 서버에 Docker를 설치하는 데 도움이 될 것입니다.

Ubuntu / Debian용

1단계: 시스템 패키지 업데이트

bash
sudo apt update
sudo apt upgrade -y

2단계: 필수 구성 요소 설치

bash
sudo apt install apt-transport-https ca-certificates curl gnupg lsb-release -y

3단계: Docker 저장소 추가 및 설치

bash
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
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
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io -y

RHEL / CentOS / Alma Linux / Rocky Linux용

1단계: 필수 구성 요소 설치

bash
sudo yum install -y yum-utils

2단계: Docker 저장소 추가 및 설치

bash
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io -y
sudo systemctl start docker
sudo systemctl enable docker

설치 확인

bash
sudo docker --version
sudo docker run hello-world

Docker Compose 설치

Docker Compose를 사용하면 다중 컨테이너 Docker 애플리케이션을 정의하고 실행할 수 있습니다. 최신 시스템에서는 플러그인으로 설치하는 것이 권장됩니다:

bash
# Ubuntu/Debian용
sudo apt update
sudo apt install docker-compose-plugin -y

# RHEL / CentOS용
sudo yum install docker-compose-plugin -y

# 확인
docker compose version

기본 Docker 명령어

bash
# 이미지 풀(pull)
docker pull nginx

# 컨테이너 실행
docker run -d -p 80:80 --name mynginx nginx

# 실행 중인 컨테이너 목록
docker ps

# 컨테이너 중지
docker stop mynginx

# 컨테이너 제거
docker rm mynginx

유용한 팁

  • sudo 없이 Docker를 실행하려면 사용자를 docker 그룹에 추가하세요: sudo usermod -aG docker $USER
  • 다중 컨테이너 애플리케이션에는 Docker Compose를 사용하세요
  • 사용하지 않는 이미지와 컨테이너를 정기적으로 정리하세요: docker system prune
  • 영구적인 데이터 저장을 위해 볼륨을 사용하세요
  • 컨테이너 리소스를 모니터링하세요: docker stats