{"id":198078,"date":"2020-08-15T10:16:17","date_gmt":"2020-08-15T02:16:17","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=198078"},"modified":"2020-08-09T17:17:45","modified_gmt":"2020-08-09T09:17:45","slug":"docker-private-image","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/docker-private-image.html","title":{"rendered":"Docker\u79c1\u6709\u955c\u50cf"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u955c\u50cf\u4ed3\u5e93\u4f5c\u4e3aDocker\u6280\u672f\u7684\u6838\u5fc3\u7ec4\u4ef6\u4e4b\u4e00\uff0c\u5176\u4e3b\u8981\u4f5c\u7528\u5c31\u662f\u8d1f\u8d23\u955c\u50cf\u5185\u5bb9\u7684\u5b58\u50a8\u548c\u5206\u53d1\u3002Docker\u955c\u50cf\u4ed3\u5e93\u4ece\u4f7f\u7528\u8303\u56f4\u6765\u8bf4\u5206\u4e3a\u201c\u516c\u6709\u955c\u50cf\u4ed3\u5e93\u201d\u548c\u201c\u79c1\u6709\u955c\u50cf\u4ed3\u5e93\u201d\uff0c\u516c\u6709\u955c\u50cf\u4ed3\u5e93\u662f\u53ef\u4ee5\u88ab\u4efb\u4f55\u4eba\u4f7f\u7528\u7684\uff0c\u4f8b\u5982Docker\u516c\u53f8\u7ef4\u62a4\u7684\u5728\u7ebf\u5b58\u50a8\u5e93Docker Hub\u4ee5\u53ca\u90e8\u5206\u4e91\u670d\u52a1\u5382\u5546(\u5982\u963f\u91cc\u4e91)\u63d0\u4f9b\u7684\u5728\u7ebfDocker\u955c\u50cf\u5e93\u7b49\uff0c\u90fd\u5c5e\u4e8e\u516c\u6709\u955c\u50cf\u4ed3\u5e93\u7684\u8303\u7574\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
Docker\u955c\u50cf\u4ed3\u5e93\u6982\u8ff0<\/strong><\/div>\n

\u955c\u50cf\u4ed3\u5e93\u4f5c\u4e3aDocker\u6280\u672f\u7684\u6838\u5fc3\u7ec4\u4ef6\u4e4b\u4e00\uff0c\u5176\u4e3b\u8981\u4f5c\u7528\u5c31\u662f\u8d1f\u8d23\u955c\u50cf\u5185\u5bb9\u7684\u5b58\u50a8\u548c\u5206\u53d1\u3002Docker\u955c\u50cf\u4ed3\u5e93\u4ece\u4f7f\u7528\u8303\u56f4\u6765\u8bf4\u5206\u4e3a\u201c\u516c\u6709\u955c\u50cf\u4ed3\u5e93\u201d\u548c\u201c\u79c1\u6709\u955c\u50cf\u4ed3\u5e93\u201d\uff0c\u516c\u6709\u955c\u50cf\u4ed3\u5e93\u662f\u53ef\u4ee5\u88ab\u4efb\u4f55\u4eba\u4f7f\u7528\u7684\uff0c\u4f8b\u5982Docker\u516c\u53f8\u7ef4\u62a4\u7684\u5728\u7ebf\u5b58\u50a8\u5e93Docker Hub\u4ee5\u53ca\u90e8\u5206\u4e91\u670d\u52a1\u5382\u5546(\u5982\u963f\u91cc\u4e91)\u63d0\u4f9b\u7684\u5728\u7ebfDocker\u955c\u50cf\u5e93\u7b49\uff0c\u90fd\u5c5e\u4e8e\u516c\u6709\u955c\u50cf\u4ed3\u5e93\u7684\u8303\u7574\u3002<\/p>\n

\u800c\u79c1\u6709\u955c\u50cf\u4ed3\u5e93\u5219\u662f\u6307\u90e8\u7f72\u5728\u516c\u53f8\u6216\u7ec4\u7ec7\u5185\u90e8\uff0c\u7528\u4e8e\u81ea\u8eab\u5e94\u7528Docker\u955c\u50cf\u5b58\u50a8\u3001\u5206\u53d1\u7684\u955c\u50cf\u4ed3\u5e93\u3002\u5728\u6784\u5efa\u516c\u53f8\u5185\u90e8\u4f7f\u7528\u7684\u81ea\u52a8\u5316\u53d1\u5e03\u7cfb\u7edf\u7684\u8fc7\u7a0b\u4e2d\uff0c\u4ece\u5b89\u5168\u7684\u89d2\u5ea6\u51fa\u53d1\uff0c\u5e94\u7528\u7684\u6253\u5305\u955c\u50cf\u4e00\u822c\u60c5\u51b5\u4e0b\u53ea\u4f1a\u88ab\u5b58\u50a8\u5728\u79c1\u6709\u955c\u50cf\u4ed3\u5e93\u4e2d\uff0cCI\/CD\u6d41\u7a0b\u7684\u8854\u63a5\u70b9\u4e5f\u662f\u901a\u8fc7\u5411\u79c1\u6709\u955c\u50cf\u4ed3\u5e93\u4e0a\u4f20\u955c\u50cf\u548c\u62c9\u53d6\u955c\u50cf\u7684\u64cd\u4f5c\u6765\u5b8c\u6210\u7684\u3002<\/p>\n

\u5728\u73b0\u9636\u6bb5\u4e3b\u6d41\u7684\u4f01\u4e1a\u7ea7\u79c1\u6709\u955c\u50cf\u4ed3\u5e93\u6784\u5efa\u65b9\u6848\u4e2d\uff0c\u6bd4\u8f83\u6d41\u884c\u7684\u662f\uff1a\u5f00\u6e90\u7684\u4f01\u4e1a\u7ea7Docker\u955c\u50cf\u4ed3\u5e93\u2014\u2014Harbor\u3001\u4ee5\u53ca\u5546\u4e1a\u955c\u50cf\u4ed3\u5e93\u2014\u2014JFrog Artifactory\u3002\u8fd9\u4e24\u79cdDocker\u955c\u50cf\u4ed3\u5e93\u5404\u81ea\u90fd\u6709\u4e00\u5b9a\u7684\u5e02\u573a\uff0c\u5c31\u4f5c\u8005\u6240\u5de5\u4f5c\u8fc7\u7684\u516c\u53f8\u6765\u8bf4\u4f7f\u7528Harbor\u548cJFrog Artifactory\u4f5c\u4e3a\u79c1\u6709\u955c\u50cf\u4ed3\u5e93\u7684\u90fd\u6709\uff0c\u4f46\u5c31\u6210\u719f\u5ea6\u548c\u529f\u80fd\u6027\u5b8c\u6574\u6027\u6765\u8bf4JFrog Artifactory\u4f5c\u4e3a\u5546\u4e1a\u7ea7\u89e3\u51b3\u65b9\u6848\u4f1a\u66f4\u5177\u4f18\u52bf\uff0c\u6240\u4ee5\u76ee\u524d\u56fd\u5185\u6709\u94b1\u7684\u4e92\u8054\u7f51\u516c\u53f8\u9009\u62e9JFrog Artifactory\u4f5c\u4e3a\u4f01\u4e1a\u7ea7\u79c1\u6709\u4ed3\u5e93\u7684\u6bd4\u8f83\u591a\uff0c\u672c\u6587\u7684\u4e3b\u8981\u5185\u5bb9\u662f\u6f14\u793a\u5982\u4f55\u901a\u8fc7Docker\u7684\u65b9\u5f0f\u6765\u5feb\u901f\u90e8\u7f72JFrog Artifactory\u5e76\u5c06\u5176\u4f5c\u4e3aDevops\u81ea\u52a8\u53d1\u5e03\u7cfb\u7edf\u7684\u79c1\u6709\u955c\u50cf\u4ed3\u5e93\u3002<\/p>\n

JFrog Artifactory\u955c\u50cf\u4ed3\u5e93\u90e8\u7f72<\/strong><\/div>\n

\u6839\u636e\u5b98\u65b9\u4ecb\u7ecdJFrogArtifactory\u662f\u76ee\u524d\u5168\u7403\u552f\u4e00\u4e00\u4e2a\u652f\u6301\u6240\u6709\u5f00\u53d1\u8bed\u8a00\uff0c\u4efb\u610f\u7ef4\u5ea6\u7684\u5143\u6570\u636e\u68c0\u7d22\u3001\u8de8\u8bed\u8a00\u6b63\u53cd\u5411\u89e3\u6790\uff0c\u5e76\u62e5\u6709\u6df1\u5ea6\u9012\u5f52\u3001\u652f\u6301\u591a\u6d3b\u5f02\u5730\u707e\u5907\u7684\u4f01\u4e1a\u7ea7\u3001\u9ad8\u53ef\u7528\u4e8c\u8fdb\u5236\u5236\u54c1\u7ba1\u7406\u4ed3\u5e93\u3002\u8fd9\u91cc\u7684\u4e8c\u8fdb\u5236\u5236\u54c1\u662f\u6307\u6784\u5efa\u8fc7\u7a0b\u7684\u8f93\u51fa\u7269\uff0c\u5305\u62ec\u8f6f\u4ef6\u5305\u3001\u6d4b\u8bd5\u62a5\u544a\uff0c\u5e94\u7528\u914d\u7f6e\u6587\u4ef6\u7b49\u53ef\u5728\u670d\u52a1\u5668\u4e0a\u76f4\u63a5\u8fd0\u884c\u6216\u53ef\u67e5\u770b\u7684\u4e8c\u8fdb\u5236\u8f6f\u4ef6\u5236\u54c1\u3002<\/p>\n

JFrog Artifactory\u652f\u6301\u591a\u79cd\u4ed3\u5e93\u7c7b\u578b\uff0c\u9664\u4e86Docker\u955c\u50cf\u4ed3\u5e93\u5916\u8fd8\u652f\u6301Maven\u3001Npm\u7b49\u5176\u4ed6\u7c7b\u578b\u7684\u4ed3\u5e93\u3002\u5728\u6b63\u5f0f\u4f01\u4e1a\u7ea7\u73af\u5883\u4e2d\u955c\u50cf\u4ed3\u5e93\u7684\u90e8\u7f72\u8981\u8003\u8651\u9ad8\u53ef\u7528\u3001\u6269\u5c55\u6027\u7b49\u8981\u6c42\uff0c\u5173\u4e8e\u8fd9\u65b9\u9762\u7684\u90e8\u7f72\u65b9\u5f0f\u53ef\u4ee5\u53c2\u8003\u5176\u4ed6\u5b98\u65b9\u6587\u6863\uff0c\u672c\u73af\u8282\u4e3a\u4e86\u65b9\u4fbf\u6f14\u793a\u5c06\u91c7\u7528Docker\u7684\u65b9\u5f0f\u8fdb\u884c\u90e8\u7f72\uff0c\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n

1)\u3001\u83b7\u53d6\u6700\u65b0JFrog Artifactory\u793e\u533a\u7248Docker\u955c\u50cf\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n

$ docker pulldocker.bintray.io\/jfrog\/artifactory-jcr:latest<\/pre>\n

\u7531\u4e8e\u7f51\u7edc\u539f\u56e0\u4e0a\u8ff0\u4e0b\u8f7d\u8fc7\u7a0b\u53ef\u80fd\u4f1a\u6bd4\u8f83\u6162\uff0c\u6709\u6761\u4ef6\u7684\u8bfb\u8005\u53ef\u4ee5\u501f\u52a9\u79d1\u5b66\u4e0a\u7f51\u65b9\u5f0f\u8fdb\u884c\u955c\u50cf\u83b7\u53d6\u3002\u5b8c\u6210\u540e\u53ef\u901a\u8fc7\u547d\u4ee4\u67e5\u770b\u5177\u4f53\u7684\u955c\u50cf\u4fe1\u606f\uff0c\u5982\u4e0b\uff1a<\/p>\n

$ docker images<\/pre>\n

2)\u3001\u521b\u5efa\u6570\u636e\u5377\u3002\u8003\u8651\u5230\u955c\u50cf\u4ed3\u5e93\u4f5c\u4e3a\u6301\u4e45\u5316\u5b58\u50a8\u670d\u52a1\uff0c\u8fd9\u91cc\u4e3a\u5176\u521b\u5efa\u5355\u72ec\u7684\u6570\u636e\u5377\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n

#\u521b\u5efa\u6570\u636e\u76ee\u5f55 \r\n$ mkdir -p ~\/docker\/volume\/artifactory<\/pre>\n
#\u5207\u6362\u5230\u4e0a\u8ff0\u76ee\u5f55\u540e\u6267\u884c\u6570\u636e\u5377\u521b\u5efa\u547d\u4ee4 \r\n$ docker volume create data_artifactory<\/pre>\n

3)\u3001\u8fd0\u884cDocker\u5bb9\u5668\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n

$ docker run --name jfrog-artifactory -d-v data_artifactory:\/var\/opt\/jfrog\/artifactory -p 8081:8081 -p 8082:8082docker.bintray.io\/jfrog\/artifactory-jcr:latest<\/pre>\n

\u5b8c\u6210\u4e0a\u8ff0\u64cd\u4f5c\u540e\uff0c\u5982\u679c\u5bb9\u5668\u8fd0\u884c\u6210\u529f\uff0c\u6b64\u65f6\u6d4f\u89c8\u5668\u8f93\u5165\u8bbf\u95ee\u5730\u5740\uff1ahttp:\/\/127.0.0.1:8082\uff0c\u5c06\u4f1a\u663e\u793a\u5982\u56fe\u6240\u793a\u754c\u9762:<\/p>\n

\"\"<\/p>\n

\u8f93\u5165\u521d\u59cb\u5bc6\u7801(admin\/password)\u540e\uff0c\u4f1a\u7ee7\u7eed\u8df3\u8f6c\u5230\u7ba1\u7406\u5458\u5bc6\u7801\u91cd\u7f6e\u754c\u9762\uff0c\u5982\u56fe\u6240\u793a\uff1a<\/p>\n

\"\"<\/p>\n

\u4f9d\u636e\u6b65\u9aa4\u8bbe\u7f6e\u597d\u7ba1\u7406\u5458\u5bc6\u7801\u3002\u4e4b\u540e\u4f1a\u7ee7\u7eed\u8981\u6c42\u8bbe\u7f6e\u5982\u8ba2\u9605\u90ae\u7bb1\u3001\u8bbf\u95ee\u7f51\u7ad9\u57df\u540d\u3001\u4ee3\u7406\u914d\u7f6e\u7b49\u4fe1\u606f\uff0c\u8fd9\u91cc\u53ef\u4ee5\u6682\u65f6\u5ffd\u7565\u76f4\u63a5\u8df3\u5230\u4ed3\u5e93\u521b\u5efa\u7684\u9875\u9762\uff0c\u5982\u56fe\u6240\u793a\uff1a<\/p>\n

\"\"<\/p>\n

\u4ece\u4e0a\u56fe\u53ef\u4ee5\u770b\u5230JFrogArtifactory\u652f\u6301\u591a\u79cd\u7c7b\u578b\u7684\u4ed3\u5e93\uff0c\u4f8b\u5982Maven\u79c1\u6709\u4ed3\u5e93\u4e5f\u53ef\u4ee5\u901a\u8fc7JFrog Artifactory\u6765\u8fdb\u884c\u914d\u7f6e\uff0c\u7531\u4e8e\u662f\u793e\u533a\u7248\u6240\u4ee5\u5f88\u591a\u5176\u4ed6\u7c7b\u578b\u7684\u4ed3\u5e93\u5e76\u672a\u514d\u8d39\u5f00\u653e!\u8fd9\u91cc\u6211\u4eec\u53ea\u9009\u62e9\u521b\u5efaDocker\u955c\u50cf\u4ed3\u5e93,\u521b\u5efa\u540e\u6548\u679c\u5982\u56fe\u6240\u793a\uff1a<\/p>\n

\"\"<\/p>\n

\u5982\u4e0a\u56fe\u6240\u793a\uff0c\u9ed8\u8ba4\u521b\u5efa\u4e86\u4e00\u4e2aRepositoryKey\u4e3adocker-local\u7684\u672c\u5730\u4ed3\u5e93\u3002\u5728\u5b9e\u9645\u5de5\u4f5c\u573a\u666f\u4e2d\u4e3a\u4e86\u4fbf\u4e8eDocker\u955c\u50cf\u7684\u7ba1\u7406\uff0c\u53ef\u4ee5\u5206\u522b\u4e3a\u540c\u4e00\u4ee3\u7801\u7a7a\u95f4\u7684\u9879\u76ee\u521b\u5efa\u5355\u72ec\u7684\u955c\u50cf\u4ed3\u5e93\uff0c\u4f8b\u5982\u6211\u4eec\u672c\u4e66\u4e2d\u6240\u6709\u7684Spring Cloud\u5b9e\u6218\u9879\u76ee\u521b\u5efa\u4e00\u4e2a\u5355\u72ec\u955c\u50cf\u4ed3\u5e93\uff0c\u70b9\u51fb\u53f3\u4e0a\u89d2\u201cNew LocalRepository\u201d\uff0c\u5982\u56fe\u6240\u793a\uff1a<\/p>\n

\"\"<\/p>\n

\u5230\u8fd9\u91ccJFrog Repository\u5bb9\u5668\u955c\u50cf\u4ed3\u5e93\u7684\u57fa\u672c\u90e8\u7f72\u5de5\u4f5c\u5c31\u5b8c\u6210\u4e86\uff0c\u540e\u9762\u81ea\u52a8\u5316\u53d1\u5e03\u7cfb\u7edf\u4e2d\u7684CI\/CD\u6d41\u7a0b\u5c06\u4ee5\u6b64\u4e3a\u57fa\u7840\u5b9e\u73b0Docker\u955c\u50cf\u7684\u5b58\u50a8\u3001\u5206\u53d1!\u5173\u6ce8\u6211\u540e\u7eed\u7684\u5185\u5bb9\u5c06\u5411\u4f60\u4ecb\u7ecd\u5982\u4f55\u6784\u5efa\u4e00\u5957\u5b8c\u6574\u7684CI\/CD\u81ea\u52a8\u53d1\u5e03\u7cfb\u7edf!<\/p>\n","protected":false},"excerpt":{"rendered":"

\u955c\u50cf\u4ed3\u5e93\u4f5c\u4e3aDocker\u6280\u672f\u7684\u6838\u5fc3\u7ec4\u4ef6\u4e4b\u4e00\uff0c\u5176\u4e3b\u8981\u4f5c\u7528\u5c31\u662f\u8d1f\u8d23\u955c\u50cf\u5185\u5bb9\u7684\u5b58\u50a8\u548c\u5206\u53d1\u3002Docker\u955c\u50cf\u4ed3\u5e93\u4ece\u4f7f\u7528 […]<\/p>\n","protected":false},"author":1329,"featured_media":198088,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-198078","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\/198078","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\/1329"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=198078"}],"version-history":[{"count":4,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/198078\/revisions"}],"predecessor-version":[{"id":198089,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/198078\/revisions\/198089"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/198088"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=198078"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=198078"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=198078"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}