1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

GitHub Container Registry에 도커 이미지 Push 하기

Last updated at Posted at 2020-09-04

package.png

TL;DR

Docker Hub 정책 변경으로 오는 11월1일부터 지난 6개월간 Push나 Pull이 없던 이미지는 삭제된다고 합니다.
백업 차원에서 GitHub의 Packages에 도커 이미지를 Push 해두면 어떨까요?

준비물

  • GitHub 계정
  • GitHub's Personal Access Token
    • GitHub Profile > Settings > Developer settings > Personal access tokens > Generate new token
      • write:packages read:packages delete:packages repo 체크 > Generate token
        001.png
        002.png
        003.png

실행하기

GitHub Container Registry 로그인

$  docker login ghcr.io -u <github_id> 
Password: #<Pesonal Access Token> 입력
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

GitHub Container Registry에 이미지 푸시

$ docker images -a
REPOSITORY        TAG        IMAGE ID        CREATED        SIZE
jenkins/jenkins   lts        135a0d19f757    5 weeks ago    667MB

# 이미지 태그하기
$ docker tag 135a0d19f757 ghcr.io/<github_id>/jenkins:lts

# GitHub에 이미지 푸시하기
$ docker push ghcr.io/<github_id>/jenkins:lts
The push refers to repository [ghcr.io/<github_id>/jenkins]
127451aea177: Pushed
f5bcfae65e8c: Pushed
687e70c08de0: Pushed
97228bebcea6: Pushed
5ea28e96a7c4: Pushed
09df571b2d1a: Pushed
1621b831e01c: Pushed
c2210d8051b3: Pushed
96706081cc19: Pushed
053d23f0bdb8: Pushed
a18cfc771ac0: Pushed
9cebc9e5d610: Pushed
d81d8fa6dfd4: Pushed
bd76253da83a: Pushed
e43c0c41b833: Pushed
01727b1a72df: Pushed
69dfa7bd7a92: Pushed
4d1ab3827f6b: Pushed
7948c3e5790c: Pushed
lts: digest: sha256:c2201520b3ee92e3d84ad8705167f7fd9b431a90e16d31a1b4407a547c3bc294 size: 4299

GitHub에서 확인하기

개인 Profile > Packages 에서 확인 가능합니다.
※ 현재는 개인 Profile > Packages 로만 접근할 수 있는 것 같습니다.
005.png

공개/비공개 설정이 가능합니다. PublicPrivate
개인 Profile > Packages > Edit package > Package settings > Make Public
013.png
012.png

이미지 버전을 지울 수도 있습니다.
개인 Profile > Packages > Settings > Edit package > View all versions
011.png
010.png

참고링크

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?