3
3

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(ghcr.io)にdocker pushする

Last updated at Posted at 2020-09-13

アドレスが長くて忘れるのでメモしておく.

docker tagコマンドの形式は以下に従う.

docker tag <コンテナ名> ghcr.io/<GitHubのユーザ名>/<パッケージ名>/<コンテナ名>:<タグ>

例えば以下になる.

$ docker images
REPOSITORY                           TAG                                              IMAGE ID            CREATED             SIZE
stns-build                           latest                                           449f1c2d3562        4 minutes ago       35.4MB

$ docker tag stns-build:latest ghcr.io/tomoyk/stns-client/stns-client:v0.1

$ docker images
REPOSITORY                               TAG                                              IMAGE ID            CREATED             SIZE
stns-build                               latest                                           449f1c2d3562        6 minutes ago       35.4MB
ghcr.io/tomoyk/stns-client/stns-client   v0.1                                             449f1c2d3562        6 minutes ago       35.4MB

最後にPushする.

docker push ghcr.io/tomoyk/stns-client/stns-client:v0.1

弾かれる場合は ~/.docker/config.json を見てみる.
auths の下にghcr.ioがあるか確かめる.

{
    "auths": {
        "ghcr.io": {
            "auth": "xxxx"
        }
     }
}

ない場合は,GitHubのWeb UIからPersonal Access Tokenを発行する.

image.png

Tokenを ~/TOKEN.txt として保存して以下のコマンドを実行する.

cat ~/TOKEN.txt | docker login https://ghcr.io -u <ユーザ名> --password-stdin

再び docker push xxx を実行する.

3
3
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
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?