>

상세 컨텐츠

본문 제목

[docker] GHCR 인증 실패 시

0. 창업

by 마켓플레이어, 마케터 봉 2025. 12. 23. 16:09

본문

1) ghcr-config.json이 정말 “정상 Base64”인지 호스트에서 검증 (내용 노출 없이)

cd ~/server/traefik

python3 - <<'PY'
import json, base64
p="ghcr-config.json"
d=json.load(open(p,"r",encoding="utf-8"))
auth=d["auths"]["ghcr.io"]["auth"]
print("auth_length:", len(auth))
try:
    raw=base64.b64decode(auth, validate=True)
    print("base64_ok: True")
    print("decoded_prefix:", raw[:10], "decoded_len:", len(raw))
except Exception as e:
    print("base64_ok: False")
    print("error:", e)
PY
  • base64_ok: False면 → 파일이 깨진 것.

 

 

2) zsh용 “정답” ghcr-config.json 재생성

cd ~/server/traefik

read -s "?GHCR PAT 입력: " PAT; echo
AUTH=$(printf '%s' "qbg5652:${PAT}" | base64 | tr -d '\n')

printf '{"auths":{"ghcr.io":{"auth":"%s"}}}\n' "$AUTH" > ghcr-config.json
chmod 600 ghcr-config.json

unset PAT AUTH

 

 

3) “진짜 pull 되는지” 먼저 확인 (watchtower 재시작 전에)

mkdir -p /tmp/ghcrtest
cp ~/server/traefik/ghcr-config.json /tmp/ghcrtest/config.json

docker --config /tmp/ghcrtest pull ghcr.io/qbg5652/bongdroid:latest
docker --config /tmp/ghcrtest pull ghcr.io/qbg5652/dailist_homepage:latest
docker --config /tmp/ghcrtest pull ghcr.io/qbg5652/recifit_backend:latest
docker --config /tmp/ghcrtest pull ghcr.io/qbg5652/recifit_batch:latest

 

 

4) Watchtower 재시작 (새 config 반영)

cd ~/server/traefik
docker compose up -d --force-recreate watchtower
docker logs watchtower --tail 120 | egrep -i "illegal base64|unauthorized|denied|updated|scanned|Loaded auth|config.json"

 

 

PAT 입력하는 건 github 접속 :  settings > Develooer settings > Personal access tokens > 토큰 확인 후 입력하면 됨.

반응형

'0. 창업' 카테고리의 다른 글

[6/18] KPT 회고  (0) 2025.06.19
[5/26] KPT 회고  (1) 2025.05.26
[부트캠프] 8주차 3  (0) 2025.04.23
[부트캠프] 8주차 2  (0) 2025.04.22
[부트캠프] 8주차 1  (0) 2025.04.21

관련글 더보기