我在 Linux (RHEL8) 上嘗試使用podman
推送到內部碼頭註冊表,但是當我執行 時,出現有關「不記名令牌」的錯誤podman push
,如下所示:
podman login -u="quay_robot_username" -p="quay_robot_password" quay.companydomain.com
Login Succeeded!
podman push f8f914cef1ce0cc6314355ae5d16c6d5faf96e595fa1332cf40d26f9c53b9c07 quay.companydomain.com/organization/repository/a890f2e
Getting image source signatures
Error: trying to reuse blob sha256:0c23ed2428e1ef41fdb571789f6968dd47c95135311b1c8bf56462c98581694b at destination: Requesting bearer token: invalid status code from registry 400 (Bad Request)
對於使用者名稱和密碼,我使用的是具有碼頭儲存庫寫入權限的碼頭機器人。
我知道 quay 正在尋找Authorization: Bearer <mytoken>
http 請求標頭。
很高興看到產生的 http 請求的標頭,以podman push
驗證標頭中是否存在不記名令牌。但是,考慮到錯誤,我假設它不存在。
兩個問題:
- 如果我還沒有不記名令牌,我該如何獲得它?
我確實在我的碼頭組織中創建了一個 Oauth 應用程序,並在那裡生成了一個訪問令牌 - 我能夠在curl 請求中成功使用它:
curl -X GET -H "Authorization: Bearer <mytoken>" https://quay.companydomain.com/api/v1/repository/organization/myrepository/tag/ | jq
該令牌適用於嗎podman push
?
- 獲得令牌後,如何將其包含在
podman push
命令的 http 請求中?
注意:我是從 github 操作啟動它的,但為了簡化事情,我只是試圖讓它在命令列上工作(無論哪種方式我都會得到相同的錯誤)。