簡體   English   中英

Docker API 推送到私有注冊表錯誤

[英]Docker API push to private registry error

我無法使用 docker API 將圖像推送到私有注冊表。 我已經閱讀了我在任何地方找到的所有內容並且嘗試了所有內容但沒有運氣......

我試過 :

 curl -X POST -H "X-Registry-Auth:XXXXXXXXXXXXXXX" http://dockerapiurl:2375/images/registryurl/python/push?tag=6

或者

curl -X POST -H 'X-Registry-Auth:{"username": "xxxxxx","password": "xxxxx", "serveraddress": "xxxx.url.net", "auth": ""}' http://dockerapiurl:2375/images/registryurl/python/push?tag=6

我總是得到同樣的錯誤:

{"errorDetail":{"message":"errors:\\ndenied: 請求訪問資源被拒絕\\nunauthorized: 需要身份驗證\\n"},"error":"errors:\\ndenied: 請求訪問資源被拒絕\\n未授權:需要身份驗證\\n"}

如果我在 CLI 模式下使用 docker push 一切正常,我做錯了什么?

謝謝!!

它需要以 base 64 編碼,試試這個

XRA=`echo "{ \"username\": \"xxxxxx\", \"password\": \"xxxxxx\", \"email\": \"youmail@example.org\", \"serveraddress\": \"xxxxxx\" }" | base64 --wrap=0`
curl  -X POST  -d "" -H "X-Registry-Auth: $XRA" http://dockerapiurl:2375/images/registryurl/python/push?tag=6

最終結果應該是這樣的

curl -X POST -d "" -H "X-Registry-Auth: eyAidXNlcm5hbWUiOiAieHh4eHh4IiwgInBhc3N3b3JkIjogInh4eHh4eCIsICJlbWFpbCI6ICJ5b3VtYWlsQGV4YW1wbGUub3JnIiB9Cg==" http://dockerapiurl:2375/images/registryurl/python/push?tag=6

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM