{"id":63747,"date":"2025-04-29T15:47:14","date_gmt":"2025-04-29T07:47:14","guid":{"rendered":"https:\/\/fwq.ai\/blog\/63747\/"},"modified":"2025-04-29T15:47:14","modified_gmt":"2025-04-29T07:47:14","slug":"docker%e9%95%9c%e5%83%8f%e6%80%8e%e4%b9%88%e4%bf%9d%e5%ad%98-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/63747\/","title":{"rendered":"docker\u955c\u50cf\u600e\u4e48\u4fdd\u5b58"},"content":{"rendered":"<blockquote><p>\n  \u5728 docker \u4e2d\u4fdd\u5b58\u955c\u50cf\uff0c\u53ef\u4ee5\u4f7f\u7528 docker commit \u547d\u4ee4\u521b\u5efa\u65b0\u7684\u955c\u50cf\uff0c\u5305\u542b\u6307\u5b9a\u5bb9\u5668\u7684\u5f53\u524d\u72b6\u6001\uff0c\u8bed\u6cd5\u4e3a\uff1adocker commit [\u9009\u9879] \u5bb9\u5668id \u955c\u50cf\u540d\u79f0\u3002\u8981\u4fdd\u5b58\u955c\u50cf\u5230\u4ed3\u5e93\uff0c\u53ef\u4ee5\u4f7f\u7528 docker push \u547d\u4ee4\uff0c\u8bed\u6cd5\u4e3a\uff1adocker push \u955c\u50cf\u540d\u79f0[:\u6807\u7b7e]\u3002\u8981\u5bfc\u5165\u5df2\u4fdd\u5b58\u7684\u955c\u50cf\uff0c\u53ef\u4ee5\u4f7f\u7528 docker pull \u547d\u4ee4\uff0c\u8bed\u6cd5\u4e3a\uff1adocker pull \u955c\u50cf\u540d\u79f0[:\u6807\u7b7e]\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/05\/2024060505391920381.jpg\" class=\"aligncenter\" title=\"docker\u955c\u50cf\u600e\u4e48\u4fdd\u5b58\u63d2\u56fe\" alt=\"docker\u955c\u50cf\u600e\u4e48\u4fdd\u5b58\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728 Docker \u4e2d\u4fdd\u5b58\u955c\u50cf<\/strong><\/p>\n<p><strong>\u4fdd\u5b58\u955c\u50cf<\/strong><\/p>\n<p>\u8981\u4fdd\u5b58 Docker \u955c\u50cf\uff0c\u53ef\u4ee5\u4f7f\u7528  commit \u547d\u4ee4\u3002\u6b64\u547d\u4ee4\u5c06\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u955c\u50cf\uff0c\u5176\u4e2d\u5305\u542b\u6307\u5b9a\u5bb9\u5668\u7684\u5f53\u524d\u72b6\u6001\u3002<\/p>\n<p><strong>\u8bed\u6cd5<\/strong><\/p>\n<pre>docker commit [\u9009\u9879] \u5bb9\u5668ID [\u955c\u50cf\u540d\u79f0][:\u6807\u7b7e]<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u9009\u9879<\/strong><\/p>\n<ul>\n<li>-a \u4f5c\u8005: \u8bbe\u7f6e\u955c\u50cf\u4f5c\u8005\u4fe1\u606f\u3002<\/li>\n<li>-m \u6ce8\u91ca: \u4e3a\u955c\u50cf\u6dfb\u52a0\u6ce8\u91ca\u3002<\/li>\n<li>-c \u63d0\u4ea4: \u4ece\u5bb9\u5668\u4e2d\u590d\u5236\u6307\u5b9a\u7684\u5bb9\u5668\u914d\u7f6e\u3002<\/li>\n<li>-q \u9759\u9ed8: \u4e0d\u663e\u793a\u4efb\u4f55\u8f93\u51fa\u3002<\/li>\n<\/ul>\n<p><strong>\u793a\u4f8b<\/strong><\/p>\n<p>\u4fdd\u5b58\u540d\u4e3a my-app \u7684\u5bb9\u5668\u4e3a\u65b0\u955c\u50cf my-image\uff1a<\/p>\n<pre>docker commit -m \"Initial commit\" my-app my-image:latest<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u4fdd\u5b58\u955c\u50cf\u5230\u4ed3\u5e93\u4e2d<\/strong><\/p>\n<p>\u8981\u5c06\u955c\u50cf\u4fdd\u5b58\u5230 Docker \u4ed3\u5e93\uff08\u5982 Docker Hub\uff09\uff0c\u53ef\u4ee5\u4f7f\u7528 docker push \u547d\u4ee4\u3002<\/p>\n<p><strong>\u8bed\u6cd5<\/strong><\/p>\n<pre>docker push \u955c\u50cf\u540d\u79f0[:\u6807\u7b7e]<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u793a\u4f8b<\/strong><\/p>\n<p>\u5c06 my-image \u955c\u50cf\u63a8\u9001\u5230 Docker Hub \u4ed3\u5e93 my-repo\uff1a<\/p>\n<pre>docker push my-repo\/my-image:latest<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u5bfc\u5165\u955c\u50cf<\/strong><\/p>\n<p>\u8981\u5bfc\u5165\u5df2\u4fdd\u5b58\u7684\u955c\u50cf\uff0c\u53ef\u4ee5\u4f7f\u7528 docker pull \u547d\u4ee4\u3002<\/p>\n<p><strong>\u8bed\u6cd5<\/strong><\/p>\n<pre>docker pull \u955c\u50cf\u540d\u79f0[:\u6807\u7b7e]<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u793a\u4f8b<\/strong><\/p>\n<p>\u4ece Docker Hub \u62c9\u53d6 my-repo\/my-image:latest \u955c\u50cf\uff1a<\/p>\n<pre>docker pull my-repo\/my-image:latest<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u9644\u52a0\u4fe1\u606f<\/strong><\/p>\n<ul>\n<li>\u60a8\u53ef\u4ee5\u4f7f\u7528 docker images \u547d\u4ee4\u67e5\u770b\u5df2\u4fdd\u5b58\u7684\u955c\u50cf\u3002<\/li>\n<li>\u60a8\u53ef\u4ee5\u4f7f\u7528 docker inspect \u547d\u4ee4\u67e5\u770b\u955c\u50cf\u7684\u8be6\u7ec6\u4fe1\u606f\u3002<\/li>\n<li>\u60a8\u53ef\u4ee5\u4f7f\u7528 docker tag \u547d\u4ee4\u66f4\u6539\u955c\u50cf\u7684\u6807\u7b7e\u6216\u540d\u79f0\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u955c\u50cf\u600e\u4e48\u4fdd\u5b58\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8FDCServers\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 docker \u4e2d\u4fdd\u5b58\u955c\u50cf\uff0c\u53ef\u4ee5\u4f7f\u7528 docker commit \u547d\u4ee4\u521b\u5efa\u65b0\u7684\u955c\u50cf\uff0c\u5305\u542b\u6307\u5b9a\u5bb9\u5668\u7684\u5f53\u524d\u72b6\u6001\uff0c\u8bed\u6cd5\u4e3a\uff1adocker commit [\u9009\u9879] \u5bb9\u5668id \u955c\u50cf\u540d\u79f0\u3002\u8981\u4fdd\u5b58\u955c\u50cf\u5230\u4ed3\u5e93\uff0c\u53ef\u4ee5\u4f7f\u7528 docker push \u547d\u4ee4\uff0c\u8bed\u6cd5\u4e3a\uff1adocker push \u955c\u50cf\u540d\u79f0[:\u6807\u7b7e]\u3002\u8981\u5bfc\u5165\u5df2\u4fdd\u5b58\u7684\u955c\u50cf\uff0c\u53ef\u4ee5\u4f7f\u7528 docker pull \u547d\u4ee4\uff0c\u8bed\u6cd5\u4e3a\uff1adocker pull \u955c\u50cf\u540d\u79f0[:\u6807\u7b7e]\u3002 \u5982\u4f55\u5728 Docker \u4e2d\u4fdd\u5b58\u955c\u50cf \u4fdd\u5b58\u955c\u50cf \u8981\u4fdd\u5b58 Docker \u955c\u50cf\uff0c\u53ef\u4ee5\u4f7f\u7528 commit \u547d\u4ee4\u3002\u6b64\u547d\u4ee4\u5c06\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u955c\u50cf\uff0c\u5176\u4e2d\u5305\u542b\u6307\u5b9a\u5bb9\u5668\u7684\u5f53\u524d\u72b6\u6001\u3002 \u8bed\u6cd5 docker commit [\u9009\u9879] \u5bb9\u5668ID [\u955c\u50cf\u540d\u79f0][:\u6807\u7b7e] \u767b\u5f55\u540e\u590d\u5236 \u9009\u9879 -a \u4f5c\u8005: \u8bbe\u7f6e\u955c\u50cf\u4f5c\u8005\u4fe1\u606f\u3002 -m \u6ce8\u91ca: \u4e3a\u955c\u50cf\u6dfb\u52a0\u6ce8\u91ca\u3002 -c \u63d0\u4ea4: \u4ece\u5bb9\u5668\u4e2d\u590d\u5236\u6307\u5b9a\u7684\u5bb9\u5668\u914d\u7f6e\u3002 -q \u9759\u9ed8: \u4e0d\u663e\u793a\u4efb\u4f55\u8f93\u51fa\u3002 \u793a\u4f8b \u4fdd\u5b58\u540d\u4e3a my-app \u7684\u5bb9\u5668\u4e3a\u65b0\u955c\u50cf my-image\uff1a docker [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-63747","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63747","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=63747"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63747\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=63747"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=63747"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=63747"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}