본문 바로가기
  • 👩🏻‍💻 🌮 💬
👩🏻‍💻/docker

github으로 docker image 공유하기 (Docker packages > Containers)

by 바쿄리 2025. 6. 6.

개요

Docker image를 github을 통해 고객에게 공유하려 함

Docker packages > Containers

 

진행

1. Access Token 발급

https://github.com/settings/tokens"Generate new token (classic)"

 

2. token name, expiration, scopes 입력 및 선택

 

3. 생성된 토큰 저장하기 (바로 hide됨)

 

4. Docker login

echo <복사한_토큰> | docker login ghcr.io -u <github_username> --password-stdin
Login Succeeded

→ 확인되면 로그인 완료된 것

 

5. build image

docker build -t ghcr.io/<GITHUB_USERNAME>/<IMAGE_NAME>:<TAG> .

 

example:

docker build -t ghcr.io/hyerypark/hello-app:latest .

→ 여기서 <GITHUB_USERNAME> 무조건 소문자로 넣기!

 

6. GitHub Container Registry로 푸시

docker push ghcr.io/<GITHUB_USERNAME>/<IMAGE_NAME>:<TAG>

 

example:

docker push ghcr.io/hyerypark/hello-app:latest

→ push가 잘 되었음을 확인했다.

 

7. image pull

docker pull ghcr.io/hyerypark/hello-app:latest

→ghcr.io/hyerypark/hello-app 이라는 docker image를 잘 pull 해오는 것을 확인할 수 있다.

 

사용 테스트 진행했고

실무에 적용하려는데 이사님이 git 말고 aws ecr 사용해서 docker image 공유하자며 ... 하하!

그래도 이렇게 git 으로 docker image push/pull 하는 방법에 대해서 공부했으니 좋다 😊 !!!!!!!!!!!!!!!!!!!!!!

 

'👩🏻‍💻 > docker' 카테고리의 다른 글

[Docker] Dockerfile COPY와 Mount 비교  (0) 2024.11.20