컨테이너 레지스트리는 Docker 이미지를 저장·버전 관리·배포하는 저장소다. 개인/팀 이미지를 안전하게 관리하고 CI/CD 파이프라인과 통합해 자동화된 이미지 배포를 가능하게 한다.
주요 레지스트리
| 레지스트리 | 제공자 | 특징 |
|---|
| Docker Hub | Docker | 공개 이미지 허브 |
| ECR | AWS | IAM 통합, ECS/EKS 최적 |
| GCR / Artifact Registry | GCP | GKE 통합 |
| ACR | Azure | AKS 통합 |
| GitHub Container Registry | GitHub | Actions 통합 |
| Harbor | 오픈소스 | 자체 호스팅 |
ECR 사용 예시
bash
# AWS ECR 인증
aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin 123456789.dkr.ecr.ap-northeast-2.amazonaws.com
# 이미지 태그
docker tag myapp:latest 123456789.dkr.ecr.ap-northeast-2.amazonaws.com/myapp:1.2.3
# 푸시
docker push 123456789.dkr.ecr.ap-northeast-2.amazonaws.com/myapp:1.2.3
# 이미지 스캔 결과 확인
aws ecr describe-image-scan-findings --repository-name myapp --image-id imageTag=1.2.3
CI/CD 통합 (GitHub Actions)
yaml
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
이미지 보안
bash
# Trivy로 취약점 스캔
trivy image myapp:latest
# Cosign으로 이미지 서명
cosign sign --key cosign.key myapp:latest
cosign verify --key cosign.pub myapp:latest
관련 개념