{"id":192334,"date":"2020-06-08T11:00:27","date_gmt":"2020-06-08T03:00:27","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=192334"},"modified":"2020-05-25T09:54:09","modified_gmt":"2020-05-25T01:54:09","slug":"docker-operational-items","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/docker-operational-items.html","title":{"rendered":"Docker\u5b9e\u6218\u4e4b\u8fd0\u884c\u9879\u76ee"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u5728\u672c\u7bc7\u6587\u7ae0\u91cc\u5c0f\u7f16\u7ed9\u5927\u5bb6\u5206\u4eab\u7684\u662f\u5173\u4e8edocker\u8fd0\u884c\u9879\u76ee\u7684\u65b9\u6cd5\u548c\u5b9e\u4f8b\uff0c\u9700\u8981\u7684\u670b\u53cb\u4eec\u5b66\u4e60\u53c2\u8003\u4e0b\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
1\u3001\u8fdb\u5165\u5b58\u653e\u81ea\u5df1\u9879\u76eewar\u7684\u76ee\u5f55<\/strong><\/div>\n

\u7f16\u8f91Dockerfile\u6587\u4ef6<\/p>\n

\r\nvim Dockerfile\r\n<\/pre>\n

\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n

\r\nrom registry.docker-cn.com\/library\/tomcat\r\n \r\nMAINTAINER heihezi heihezi@foxmail.com\r\n \r\nCOPY myproject.war \/usr\/local\/tomcat\/webapps\r\n<\/pre>\n
2\u3001build\u81ea\u5df1\u7684\u955c\u50cf<\/strong><\/div>\n
\r\ndocker build -t myproject:latest .\r\n<\/pre>\n

\u4e0d\u51fa\u610f\u5916\u7684\u4f1a\u663e\u793abuild\u955c\u50cf\u7684\u6b65\u9aa4\uff0c\u6700\u540e\u4e00\u884c\u4e3a<\/p>\n

\r\nSuccessfully built b3f6ac3157ae\r\n<\/pre>\n

\u6700\u540e\u7684\u5b57\u7b26\u4e32\u662f\u955c\u50cfid\u7684\u4e00\u90e8\u5206\u3002<\/p>\n

\u6b64\u65f6\u53ef\u4ee5\u8fd0\u884cdocker images\u67e5\u770b\u81ea\u5df1\u7684\u955c\u50cf\u4fe1\u606f<\/p>\n

3\u3001\u8fd0\u884c\u81ea\u5df1\u7684docker\u5bb9\u5668<\/strong><\/div>\n
\r\ndocker run -d -p 8888:8080 myproject\r\n<\/pre>\n

\u8fd9\u91cc -d \u662f\u540e\u53f0\u8fd0\u884c\uff0c-p \u662f\u6307\u5b9a\u7aef\u53e3\uff0c\u540e\u9762\u7684 8888:8080 \u662f\u6620\u5c04\u5bbf\u4e3b\u673a\u76848888\u7aef\u53e3\u5230docker\u76848080\u7aef\u53e3\uff0c\u8fd9\u65f6\u5982\u679c\u8fd0\u884c\u6210\u529f\u4f1a\u6253\u5370\u51fa\u4e00\u4e2aid<\/p>\n

4\u3001\u8bbf\u95ee\u81ea\u5df1\u7684\u9879\u76ee<\/strong><\/div>\n

\u67e5\u770btomcat\u662f\u5426\u542f\u52a8\u6210\u529f<\/p>\n

\r\n192.168.1.178:8888\r\n<\/pre>\n

\u8bbf\u95ee\u9879\u76ee(\u52a0\u9879\u76ee\u540d)<\/p>\n

\r\n192.168.1.178:8888\/myproject\r\n<\/pre>\n

\u5230\u6b64\u8fd9\u7bc7\u5173\u4e8edocker\u8fd0\u884c\u9879\u76ee\u7684\u65b9\u6cd5\u7684\u6587\u7ae0\u5c31\u4ecb\u7ecd\u5230\u8fd9\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u7f16\u8f91Dockerfile\u6587\u4ef6 vim Dockerfile \u5185\u5bb9\u5982\u4e0b\uff1a rom registry.docker […]<\/p>\n","protected":false},"author":63,"featured_media":192335,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-192334","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\/192334","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=192334"}],"version-history":[{"count":1,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/192334\/revisions"}],"predecessor-version":[{"id":192336,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/192334\/revisions\/192336"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/192335"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=192334"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=192334"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=192334"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}