{"id":17414,"date":"2025-05-23T15:03:32","date_gmt":"2025-05-23T07:03:32","guid":{"rendered":"https:\/\/92it.top\/?p=17414"},"modified":"2025-06-06T10:03:06","modified_gmt":"2025-06-06T02:03:06","slug":"%e5%88%a0%e9%99%a4-docker-registry-%e7%a7%81%e6%9c%89%e4%bb%93%e5%ba%93%e7%9a%84%e9%95%9c%e5%83%8f","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=17414","title":{"rendered":"\u5220\u9664 Docker-registry \u79c1\u6709\u4ed3\u5e93\u7684\u955c\u50cf"},"content":{"rendered":"\n<p>\u8f6c\u8f7d\uff1a<a href=\"https:\/\/www.cnblogs.com\/chen2ha\/p\/18469181\">https:\/\/www.cnblogs.com\/chen2ha\/p\/18469181<\/a><\/p>\n\n\n\n<p><strong>\u67e5\u770b\u79c1\u6709\u4ed3\u5e93\u6709\u54ea\u4e9b\u955c\u50cf<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u5982\u679c\u79c1\u6709\u4ed3\u5e93\u5e26\u6709\u8ba4\u8bc1\uff0c\u5728\u4f7f\u7528 curl \u547d\u4ee4\u7684\u65f6\u5019\u9700\u8981\u5e26\u4e0a -u \u53c2\u6570<\/p>\n\n\n\n<p>\u4f7f\u7528\u65b9\u6cd5\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">curl -XGET -u admin:admin http:\/\/192.168.91.18:5000\/v2\/_catalog<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">curl -XGET -u admin:admin http:\/\/192.168.91.18:5000\/v2\/_catalog<\/pre>\n\n\n\n<p>\u8f93\u51fa\u7684\u683c\u5f0f\u4e3a json<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">{\"repositories\":[\"centos\",\"debian\",\"mysql\",\"nginx\",\"php\"]}<\/pre>\n\n\n\n<p><strong>\u67e5\u770b\u79c1\u6709\u4ed3\u5e93\u955c\u50cf\u7684tag<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u4f7f\u7528\u65b9\u6cd5\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">curl -XGET -u &lt;\u4ed3\u5e93\u7528\u6237\u540d&gt;:&lt;\u7528\u6237\u540d\u5bc6\u7801&gt; http:\/\/&lt;\u4ed3\u5e93ip\u5730\u5740&gt;:&lt;\u4ed3\u5e93\u7aef\u53e3&gt;\/v2\/&lt;\u955c\u50cf\u540d\u79f0&gt;\/targs\/list<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">curl -XGET -u admin:admin http:\/\/192.168.91.18:5000\/v2\/centos\/tags\/list<\/pre>\n\n\n\n<p>\u8f93\u51fa\u7684\u683c\u5f0f\u4e3a json\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">{\"name\":\"centos\",\"tags\":[\"latest\",\"7\"]}<\/pre>\n\n\n\n<p><strong>\u5220\u9664\u79c1\u6709\u4ed3\u5e93\u6307\u5b9a\u955c\u50cf<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<ul>\n<li>\u786e\u8ba4\u662f\u5426\u5f00\u542f\u5220\u9664\u529f\u80fd\uff08\u5982\u679c\u6ca1\u6709\u5f00\u542f\uff0c\u6267\u884c\u5220\u9664\u955c\u50cf\u64cd\u4f5c\u7684\u65f6\u5019\uff0c\u4f1a\u8fd4\u56de\u5982\u4e0b\u4e24\u79cd\u7ed3\u679c\uff09<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\"errors\":[{\"code\":\"UNSUPPORTED\",\"message\":\"The operation is unsupported.\"}]}<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">HTTP\/1.1 405 Method Not Allowed\nContent-Type: application\/json; charset=utf-8\nDocker-Distribution-Api-Version: registry\/2.0\nX-Content-Type-Options: nosniff\nDate: Fri, 18 Mar 2022 04:12:22 GMT\nContent-Length: 78<\/pre>\n\n\n\n<ul>\n<li>\u67e5\u627e registry \u5bb9\u5668<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker ps | grep registry<\/pre>\n\n\n\n<ul>\n<li>\u8fdb\u5165\u5bb9\u5668<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">registry \u8fdb\u5165\u5bb9\u5668\u7684\u7ec8\u7aef\u662f sh\ndocker exec -it 3745255afa90 sh<\/pre>\n\n\n\n<ul>\n<li>\u4e00\u822c\u90fd\u662f\u5728 <code>\/etc\/docker\/registry\/config.yml<\/code><\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">registry \u955c\u50cf\u91cc\u9762\u6709 vi \u6ca1\u6709 vim\nvi \/etc\/docker\/registry\/config.yml<\/pre>\n\n\n\n<ul>\n<li>\u6211\u62c9\u53d6\u7684 registry \u955c\u50cf\u9ed8\u8ba4\u6ca1\u6709\u914d\u7f6e delete \u529f\u80fd<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">version: 0.1\nlog:\n  fields:\n    service: registry\nstorage:\n  cache:\n    blobdescriptor: inmemory\n  filesystem:\n    rootdirectory: \/var\/lib\/registry\n# \u589e\u52a0\u8fd9\u91cc\u7684 delete \u548c enabled \uff0c\u6ce8\u610f yaml \u8bed\u6cd5\u683c\u5f0f\n# \u5982\u679c\u6709 delete \uff0c\u5e76\u4e14 enable \u4e3a true \u8868\u793a\u5df2\u7ecf\u5f00\u542f\u4e86\u5220\u9664\u529f\u80fd\n  delete:\n    enabled: true\nhttp:\n  addr: :5000\n  headers:\n    X-Content-Type-Options: [nosniff]\nhealth:\n  storagedriver:\n    enabled: true\n    interval: 10s\n    threshold: 3\n<\/pre>\n\n\n\n<ul>\n<li>\u4fee\u6539\u5b8c\u6210\u540e\uff0c\u91cd\u542f registry \u5bb9\u5668<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker restart 3745255afa90<\/pre>\n\n\n\n<p><strong>\u83b7\u53d6\u6307\u5b9a\u955c\u50cf\u7684 hash \u503c<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u4f7f\u7528\u65b9\u6cd5<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">curl --header \"Accept:application\/vnd.docker.distribution.manifest.v2+json\" -I \\ -u &lt;\u4ed3\u5e93\u7528\u6237\u540d&gt;:&lt;\u7528\u6237\u540d\u5bc6\u7801&gt; http:\/\/&lt;\u4ed3\u5e93ip\u5730\u5740&gt;:&lt;\u4ed3\u5e93\u7aef\u53e3&gt;\/v2\/&lt;\u955c\u50cf\u540d\u79f0&gt;\/manifests\/&lt;\u955c\u50cf tag&gt;<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">curl -I -XGET --header \"Accept:application\/vnd.docker.distribution.manifest.v2+json\" \\\n-u admin:admin http:\/\/192.168.91.18:5000\/v2\/centos\/manifests\/latest<\/pre>\n\n\n\n<p>Docker-Content-Digest \u8fd9\u91cc\u5c31\u4f1a\u51fa\u73b0\u955c\u50cf\u7684 hash \u503c<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">HTTP\/1.1 200 OK\nContent-Length: 529\nContent-Type: application\/vnd.docker.distribution.manifest.v2+json\nDocker-Content-Digest: sha256:a1801b843b1bfaf77c501e7a6d3f709401a1e0c83863037fa3aab063a7fdb9dc\nDocker-Distribution-Api-Version: registry\/2.0\nEtag: \"sha256:a1801b843b1bfaf77c501e7a6d3f709401a1e0c83863037fa3aab063a7fdb9dc\"\nX-Content-Type-Options: nosniff\nDate: Fri, 18 Mar 2022 04:06:42 GMT<\/pre>\n\n\n\n<p>\u5176\u5b9e\u5982\u679c\u80fd\u767b\u5f55 Docker-registry \u670d\u52a1\u5668registry\u6302\u8f7d\u7684\u76ee\u5f55\uff0c\u80fd\u76f4\u63a5\u770b\u5230\u8fd9\u4e2asha256\u7684\u503c<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"409\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/05\/image-50-1024x409.png\" alt=\"\" class=\"wp-image-17415\" style=\"width:498px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/05\/image-50-1024x409.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/05\/image-50-300x120.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/05\/image-50-768x307.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/05\/image-50-830x332.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/05\/image-50-230x92.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/05\/image-50-350x140.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/05\/image-50-480x192.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2025\/05\/image-50.png 1206w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p><strong>\u5220\u9664\u79c1\u6709\u4ed3\u5e93\u4e2d\u7684\u955c\u50cf<\/strong>Tag<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u4f7f\u7528\u65b9\u6cd5<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">curl -I -XDELETE -u &lt;\u4ed3\u5e93\u7528\u6237\u540d&gt;:&lt;\u7528\u6237\u540d\u5bc6\u7801&gt; \\ http:\/\/&lt;\u4ed3\u5e93ip\u5730\u5740&gt;:&lt;\u4ed3\u5e93\u7aef\u53e3&gt;\/v2\/&lt;\u955c\u50cf\u540d\u79f0&gt;\/manifests\/&lt;\u83b7\u53d6\u7684 hash \u503c&gt;<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">curl -I -XDELETE -u admin:admin \\\nhttp:\/\/192.168.91.18:5000\/v2\/centos\/manifests\/sha256:a1801b843b1bfaf77c501e7a6d3f709401a1e0c83863037fa3aab063a7fdb9dc<\/pre>\n\n\n\n<p>\u8fd4\u56de\u7684\u72b6\u6001\u7801\u662f 202<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">HTTP\/1.1 202 Accepted\nDocker-Distribution-Api-Version: registry\/2.0\nX-Content-Type-Options: nosniff\nDate: Fri, 18 Mar 2022 04:24:23 GMT\nContent-Length: 0<\/pre>\n\n\n\n<p>\u518d\u6b21\u67e5\u770b centos \u955c\u50cf\u7684 tag \u5217\u8868<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">curl -XGET -u admin:admin http:\/\/192.168.91.18:5000\/v2\/centos\/tags\/list<\/pre>\n\n\n\n<p>\u73b0\u5728\u53ea\u6709\u4e00\u4e2a 7 \u8fd9\u4e2a tag \u7684\u955c\u50cf\u4e86<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">{\"name\":\"centos\",\"tags\":[\"7\"]}<\/pre>\n\n\n\n<p>\u2757\ufe0f<strong>\u6ce8\u610f\uff1a<\/strong>curl -XDELETE \u53ea\u662f\u5220\u9664\u4e86\u955c\u50cfTag\uff0c\u8fd9\u4e2a\u955c\u50cfrepositorie\u672c\u8eab\u8fd8\u5728\uff0c\u662f\u7a7a\u7684\uff0c<strong>\u4ec5\u5220\u9664\u4e86\u7279\u5b9a Digest \u7684\u6807\u7b7e<\/strong>\uff0c\u800c\u975e\u6574\u4e2a\u4ed3\u5e93\u3002\u5373\u4f7f\u6240\u6709\u6807\u7b7e\u88ab\u5220\u9664\uff0c\u4ed3\u5e93\u540d\u79f0\u4ecd\u4f1a\u4fdd\u7559\uff08\u5360\u7528\u547d\u540d\u7a7a\u95f4\uff09\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"924\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/06\/image-59-1024x924.png\" alt=\"\" class=\"wp-image-17565\" style=\"width:428px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2025\/06\/image-59-1024x924.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2025\/06\/image-59-300x271.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2025\/06\/image-59-768x693.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2025\/06\/image-59-830x749.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2025\/06\/image-59-230x208.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2025\/06\/image-59-350x316.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2025\/06\/image-59-480x433.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2025\/06\/image-59.png 1296w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p><strong>\u5f7b\u5e95\u5220\u9664\u4ed3\u5e93\u7684\u65b9\u6cd5<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u624b\u52a8\u5220\u9664\u6587\u4ef6\u7cfb\u7edf\uff08\u9002\u7528\u4e8e Docker Registry V2\uff09<\/strong><\/h4>\n\n\n\n<p>\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662f\u5b98\u65b9 Docker Registry V2 \u670d\u52a1\uff0c\u4e14\u6570\u636e\u5b58\u50a8\u5728\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># 1. \u505c\u6b62 Registry \u670d\u52a1\ndocker stop registry\n\n# 2. \u5220\u9664\u5bf9\u5e94\u4ed3\u5e93\u76ee\u5f55\uff08\u6570\u636e\u5377\u8def\u5f84\u6839\u636e\u4f60\u7684\u914d\u7f6e\u800c\u5b9a\uff09\nrm -rf \/var\/lib\/registry\/docker\/registry\/v2\/repositories\/&lt;\u955c\u50cf\u540d\u79f0>\/\n\n# 3. \u91cd\u542f Registry \u670d\u52a1\ndocker start registry<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u8f6c\u8f7d\uff1ahttps:\/\/www.cnblogs.com\/chen2ha\/p\/18469181 \u67e5\u770b\u79c1\u6709\u4ed3\u5e93\u6709\u54ea\u4e9b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/17414"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=17414"}],"version-history":[{"count":4,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/17414\/revisions"}],"predecessor-version":[{"id":17567,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/17414\/revisions\/17567"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=17414"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=17414"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=17414"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}