{"id":100555,"date":"2024-07-20T03:02:11","date_gmt":"2024-07-19T19:02:11","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=100555"},"modified":"2024-07-20T03:02:11","modified_gmt":"2024-07-19T19:02:11","slug":"howto-dockerhub","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/howto-dockerhub.html","title":{"rendered":"DockerHub\u5165\u95e8"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u9996\u5148\uff1a\u4ec0\u4e48\u662f DockerHub \u4ee5\u53ca\u4e3a\u4ec0\u4e48\u5b83\u5f88\u91cd\u8981\uff1fDockerHub \u662f\u4e00\u4e2a\u7531 Docker \u516c\u53f8\u8fd0\u884c\u548c\u7ba1\u7406\u7684\u57fa\u4e8e\u4e91\u7684\u5b58\u50a8\u5e93\u3002\u5b83\u662f\u4e00\u4e2a\u5728\u7ebf\u5b58\u50a8\u5e93\uff0cDocker \u955c\u50cf\u53ef\u4ee5\u7531\u5176\u4ed6\u7528\u6237\u53d1\u5e03\u548c\u4f7f\u7528\u3002\u6709\u4e24\u79cd\u5e93\uff1a\u516c\u5171\u5b58\u50a8\u5e93\u548c\u79c1\u6709\u5b58\u50a8\u5e93\u3002\u5982\u679c\u4f60\u662f\u4e00\u5bb6\u516c\u53f8\uff0c\u4f60\u53ef\u4ee5\u5728\u4f60\u81ea\u5df1\u7684\u7ec4\u7ec7\u5185\u62e5\u6709\u4e00\u4e2a\u79c1\u6709\u5b58\u50a8\u5e93\uff0c\u800c\u516c\u5171\u955c\u50cf\u53ef\u4ee5\u88ab\u4efb\u4f55\u4eba\u4f7f\u7528\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

 <\/p>\n

\"\"<\/p>\n

\u4f60\u4e5f\u53ef\u4ee5\u4f7f\u7528\u516c\u5f00\u53d1\u5e03\u7684\u5b98\u65b9 Docker \u955c\u50cf\u3002\u6211\u4f7f\u7528\u4e86\u5f88\u591a\u8fd9\u6837\u7684\u955c\u50cf\uff0c\u5305\u62ec\u6211\u7684\u8bd5\u9a8c WordPress \u73af\u5883\u3001KDE plasma \u5e94\u7528\u7a0b\u5e8f\u7b49\u7b49\u3002\u867d\u7136\u6211\u4eec\u4e0a\u6b21\u5b66\u4e60\u4e86\u5982\u4f55\u521b\u5efa\u81ea\u5df1\u7684 Docker \u955c\u50cf\uff0c\u4f46\u4f60\u4e0d\u5fc5\u8fd9\u6837\u505a\u3002DockerHub \u4e0a\u53d1\u5e03\u4e86\u6570\u5343\u955c\u50cf\u4f9b\u4f60\u4f7f\u7528\u3002DockerHub \u4f5c\u4e3a\u9ed8\u8ba4\u5b58\u50a8\u5e93\u786c\u7f16\u7801\u5230 Docker \u4e2d\uff0c\u6240\u4ee5\u5f53\u4f60\u5bf9\u4efb\u4f55\u955c\u50cf\u8fd0\u884c docker pull \u547d\u4ee4\u65f6\uff0c\u5b83\u5c06\u4ece DockerHub \u4e0b\u8f7d\u3002<\/p>\n

\u4ece Docker Hub \u4e0b\u8f7d\u955c\u50cf\u5e76\u5728\u672c\u5730\u8fd0\u884c<\/strong><\/div>\n

\u5f00\u59cb\u8bf7\u67e5\u770b\u672c\u7cfb\u5217\u7684\u524d\u51e0\u7bc7\u6587\u7ae0\uff0c\u4ee5\u4fbf\u7ee7\u7eed\u3002\u7136\u540e\uff0c\u4e00\u65e6 Docker \u5728\u4f60\u7684\u7cfb\u7edf\u4e0a\u8fd0\u884c\uff0c\u4f60\u5c31\u53ef\u4ee5\u6253\u5f00\u7ec8\u7aef\u5e76\u8fd0\u884c\uff1a<\/p>\n

$ docker images\r\n<\/pre>\n

\u8be5\u547d\u4ee4\u5c06\u663e\u793a\u5f53\u524d\u7cfb\u7edf\u4e0a\u6240\u6709\u7684 docker \u955c\u50cf\u3002\u5047\u8bbe\u4f60\u60f3\u5728\u672c\u5730\u673a\u5668\u4e0a\u90e8\u7f72 Ubuntu\uff0c\u4f60\u53ef\u80fd\u4f1a\uff1a<\/p>\n

$ docker pull ubuntu\r\n<\/pre>\n

\u5982\u679c\u4f60\u7684\u7cfb\u7edf\u4e0a\u5df2\u7ecf\u5b58\u5728 Ubuntu \u955c\u50cf\uff0c\u90a3\u4e48\u8be5\u547d\u4ee4\u4f1a\u81ea\u52a8\u5c06\u8be5\u7cfb\u7edf\u66f4\u65b0\u5230\u6700\u65b0\u7248\u672c\u3002\u56e0\u6b64\uff0c\u5982\u679c\u4f60\u60f3\u8981\u66f4\u65b0\u73b0\u6709\u7684\u955c\u50cf\uff0c\u53ea\u9700\u8fd0\u884c docker pull \u547d\u4ee4\uff0c\u6613\u5982\u53cd\u638c\u3002\u8fd9\u5c31\u50cf apt-get update \u4e00\u6837\uff0c\u6ca1\u6709\u4efb\u4f55\u7684\u6df7\u4e71\u548c\u9ebb\u70e6\u3002<\/p>\n

\u4f60\u5df2\u7ecf\u77e5\u9053\u4e86\u5982\u4f55\u8fd0\u884c\u955c\u50cf\uff1a<\/p>\n

$ docker run -it \r\n$ docker run -it ubuntu\r\n<\/pre>\n

\u547d\u4ee4\u63d0\u793a\u7b26\u5e94\u8be5\u53d8\u4e3a\u5982\u4e0b\u5185\u5bb9\uff1a<\/p>\n

root@1b3ec4621737:\/#\r\n<\/span><\/pre>\n

\u73b0\u5728\u4f60\u53ef\u4ee5\u8fd0\u884c\u4efb\u4f55\u5c5e\u4e8e Ubuntu \u7684\u547d\u4ee4\u548c\u5b9e\u7528\u7a0b\u5e8f\uff0c\u8fd9\u4e9b\u90fd\u88ab\u5305\u542b\u5728\u5185\u800c\u4e14\u5b89\u5168\u3002\u4f60\u53ef\u4ee5\u5728 Ubuntu \u4e0a\u8fd0\u884c\u4f60\u60f3\u8981\u7684\u6240\u6709\u5b9e\u9a8c\u548c\u6d4b\u8bd5\u3002\u4e00\u65e6\u4f60\u5b8c\u6210\u4e86\u6d4b\u8bd5\uff0c\u4f60\u5c31\u53ef\u4ee5\u9500\u6bc1\u955c\u50cf\u5e76\u4e0b\u8f7d\u4e00\u4e2a\u65b0\u7684\u3002\u5728\u865a\u62df\u673a\u4e2d\u4e0d\u5b58\u5728\u7cfb\u7edf\u5f00\u9500\u3002<\/p>\n

\u4f60\u53ef\u4ee5\u901a\u8fc7\u8fd0\u884c exit \u547d\u4ee4\u9000\u51fa\u8be5\u5bb9\u5668\uff1a<\/p>\n

$ exit\r\n<\/span><\/pre>\n

\u73b0\u5728\u5047\u8bbe\u4f60\u60f3\u5728\u7cfb\u7edf\u4e0a\u5b89\u88c5 Nginx\uff0c\u8fd0\u884c search \u547d\u4ee4\u6765\u627e\u5230\u9700\u8981\u7684\u955c\u50cf\uff1a<\/p>\n

$ docker search nginx\r\n<\/pre>\n

\"\"<\/p>\n

\u6b63\u5982\u4f60\u6240\u770b\u5230\u7684\uff0cDockerHub \u4e0a\u6709\u5f88\u591a Nginx \u955c\u50cf\u3002\u4e3a\u4ec0\u4e48\uff1f\u56e0\u4e3a\u4efb\u4f55\u4eba\u90fd\u53ef\u4ee5\u53d1\u5e03\u955c\u50cf\uff0c\u5404\u79cd\u955c\u50cf\u9488\u5bf9\u4e0d\u540c\u7684\u9879\u76ee\u8fdb\u884c\u4e86\u4f18\u5316\uff0c\u56e0\u6b64\u4f60\u53ef\u4ee5\u9009\u62e9\u5408\u9002\u7684\u955c\u50cf\u3002\u4f60\u53ea\u9700\u8981\u4e3a\u4f60\u7684\u9700\u6c42\u5b89\u88c5\u5408\u9002\u7684\u955c\u50cf\u3002<\/p>\n

\u5047\u8bbe\u4f60\u60f3\u8981\u62c9\u53d6 Bitnami \u7684 Nginx \u955c\u50cf\uff1a<\/p>\n

$ docker pull bitnami\/<\/span>nginx\r\n<\/span><\/pre>\n

\u73b0\u5728\u8fd0\u884c\uff1a<\/p>\n

$ docker run -<\/span>it bitnami<\/span>\/<\/span>nginx\r\n<\/span><\/pre>\n
\u5982\u4f55\u53d1\u5e03\u955c\u50cf\u5230 Docker Hub\uff1f<\/strong><\/div>\n

\u5728\u6b64\u4e4b\u524d\uff0c\u6211\u4eec\u5b66\u4e60\u4e86\u5982\u4f55\u521b\u5efa Docker \u955c\u50cf\uff0c\u6211\u4eec\u53ef\u4ee5\u8f7b\u677e\u5730\u5c06\u8be5\u955c\u50cf\u53d1\u5e03\u5230 DockerHub \u4e2d\u3002\u9996\u5148\uff0c\u4f60\u9700\u8981\u767b\u5f55 DockerHub\uff0c\u5982\u679c\u6ca1\u6709\u8d26\u6237\uff0c\u8bf7 \u521b\u5efa\u8d26\u6237\u3002\u7136\u540e\uff0c\u4f60\u53ef\u4ee5\u6253\u5f00\u7ec8\u7aef\u5e94\u7528\uff0c\u767b\u5f55\uff1a<\/p>\n

$ docker login<\/span> --<\/span>username<\/span>=<<\/span>USERNAME<\/span>>\r\n<\/span><\/pre>\n

\u5c06 \u201c\u201d \u66ff\u6362\u4e3a\u4f60\u81ea\u5df1\u7684 Docker Hub \u7528\u6237\u540d\u3002\u6211\u8fd9\u91cc\u662f arnieswap\uff1a<\/p>\n

$ docker login<\/span> --<\/span>username<\/span>=<\/span>arnieswap\r\n<\/span><\/pre>\n

\u8f93\u5165\u5bc6\u7801\uff0c\u4f60\u5c31\u767b\u5f55\u4e86\u3002\u73b0\u5728\u8fd0\u884c docker images \u547d\u4ee4\u6765\u83b7\u53d6\u4f60\u4e0a\u6b21\u521b\u5efa\u7684\u955c\u50cf\u7684 ID\u3002<\/p>\n

$ docker images\r\n<\/pre>\n

\"\"<\/p>\n

\u73b0\u5728\uff0c\u5047\u8bbe\u4f60\u5e0c\u671b\u5c06\u955c\u50cf ng \u63a8\u9001\u5230 DockerHub\uff0c\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u6807\u8bb0\u8be5\u955c\u50cf\uff08\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u6807\u8bb0\u7684\u4fe1\u606f\uff09\uff1a<\/p>\n

$ docker tag e7083fd898c7 arnieswap\/<\/span>my_repo<\/span>:<\/span>testing\r\n<\/span><\/pre>\n

\u73b0\u5728\u63a8\u9001\u955c\u50cf\uff1a<\/p>\n

$ docker push arnieswap\/<\/span>my_repo\r\n<\/span><\/pre>\n

\u63a8\u9001\u6307\u5411\u7684\u662f docker.io\/arnieswap\/my_repo \u4ed3\u5e93\uff1a<\/p>\n

12628b20827e: Pushed\r\n8600ee70176b: Mounted from library\/ubuntu\r\n2bbb3cec611d: Mounted from library\/ubuntu\r\nd2bb1fc88136: Mounted from library\/ubuntu\r\na6a01ad8b53f: Mounted from library\/ubuntu\r\n833649a3e04c: Mounted from library\/ubuntu\r\ntesting: digest: sha256:286cb866f34a2aa85c9fd810ac2cedd87699c02731db1b8ca1cfad16ef17c146 size: 1569\r\n<\/pre>\n

\u54e6\u8036\uff01\u4f60\u7684\u955c\u50cf\u6b63\u5728\u4e0a\u4f20\u3002\u4e00\u65e6\u5b8c\u6210\uff0c\u6253\u5f00 DockerHub\uff0c\u767b\u5f55\u5230\u4f60\u7684\u8d26\u6237\uff0c\u4f60\u5c31\u80fd\u770b\u5230\u4f60\u7684\u7b2c\u4e00\u4e2a Docker \u955c\u50cf\u3002\u73b0\u5728\u4efb\u4f55\u4eba\u90fd\u53ef\u4ee5\u90e8\u7f72\u4f60\u7684\u955c\u50cf\u3002\u8fd9\u662f\u5f00\u53d1\u8f6f\u4ef6\u548c\u53d1\u5e03\u8f6f\u4ef6\u6700\u7b80\u5355\uff0c\u6700\u5feb\u901f\u7684\u65b9\u5f0f\u3002\u65e0\u8bba\u4f60\u4f55\u65f6\u66f4\u65b0\u955c\u50cf\uff0c\u7528\u6237\u90fd\u53ef\u4ee5\u7b80\u5355\u5730\u8fd0\u884c\uff1a<\/p>\n

$ docker run arnieswap\/<\/span>my_repo\r\n<\/span><\/pre>\n

\u73b0\u5728\u4f60\u77e5\u9053\u4e3a\u4ec0\u4e48\u4eba\u4eec\u559c\u6b22 Docker \u5bb9\u5668\u4e86\u3002\u5b83\u89e3\u51b3\u4e86\u4f20\u7edf\u5de5\u4f5c\u8d1f\u8f7d\u6240\u9762\u4e34\u7684\u8bb8\u591a\u95ee\u9898\uff0c\u5e76\u5141\u8bb8\u4f60\u5728\u4efb\u4f55\u65f6\u5019\u5f00\u53d1\u3001\u6d4b\u8bd5\u548c\u90e8\u7f72\u5e94\u7528\u7a0b\u5e8f\u3002\u901a\u8fc7\u9075\u5faa\u672c\u7cfb\u5217\u4e2d\u7684\u6b65\u9aa4\uff0c\u4f60\u81ea\u5df1\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u4e0b\u3002<\/p>\n


\n

via: https:\/\/www.linux.com\/blog\/learn\/intro-to-linux\/2018\/1\/how-use-dockerhub<\/a><\/p>\n

\u4f5c\u8005\uff1aSwapnil Bhartiya<\/a> \u8bd1\u8005\uff1aMjSeven<\/a> \u6821\u5bf9\uff1awxy<\/a><\/p>\n

\u672c\u6587\u7531 LCTT<\/a> \u539f\u521b\u7f16\u8bd1\uff0cLinux\u4e2d\u56fd<\/a> \u8363\u8a89\u63a8\u51fa<\/p>\n

\n

\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/linux.cn\/article-9551-1.html<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1a https:\/\/lrxjmw.cn\/howto-dockerhub.html<\/a>\u7f16\u8f91\uff1a\u674e\u5e05\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb \u9996\u5148\uff1a\u4ec0\u4e48\u662f DockerHub \u4ee5\u53ca\u4e3a\u4ec0\u4e48\u5b83\u5f88\u91cd\u8981\uff1fDockerHub \u662f\u4e00\u4e2a\u7531 Docker \u516c\u53f8\u8fd0 […]<\/p>\n","protected":false},"author":63,"featured_media":100566,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-100555","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/100555","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=100555"}],"version-history":[{"count":13,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/100555\/revisions"}],"predecessor-version":[{"id":292332,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/100555\/revisions\/292332"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/100566"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=100555"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=100555"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=100555"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}