{"id":261,"date":"2023-09-15T13:44:47","date_gmt":"2023-09-15T05:44:47","guid":{"rendered":"https:\/\/www.666818.xyz\/?p=261"},"modified":"2023-09-15T13:46:35","modified_gmt":"2023-09-15T05:46:35","slug":"docker%e9%83%a8%e7%bd%b2java%e5%89%8d%e5%90%8e%e7%ab%af%e5%88%86%e7%a6%bb%e9%a1%b9%e7%9b%ae","status":"publish","type":"post","link":"https:\/\/www.wkv.cc\/index.php\/2023\/09\/15\/docker%e9%83%a8%e7%bd%b2java%e5%89%8d%e5%90%8e%e7%ab%af%e5%88%86%e7%a6%bb%e9%a1%b9%e7%9b%ae\/","title":{"rendered":"docker\u90e8\u7f72java\u524d\u540e\u7aef\u5206\u79bb\u9879\u76ee"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">1\u3001\u62c9\u53d6java\u955c\u50cf<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>docker pull openjdk:8u252<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2\u3001\u8fd0\u884cjar\u6587\u4ef6\uff0c\u751f\u6210jar\u5bb9\u5668<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>docker run -d \n    -p 8050:8050 \n    -v \/data\/xxx:\/data\/xx \n    --name xx \n    openjdk:8u252 java -jar \/data\/xx\/xx.jar<\/code><\/pre>\n\n\n\n<p><strong>\u65e5\u5fd7\u67e5\u770b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker logs -f --tail 100 xx<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>-d\uff1a\u540e\u53f0\u8fd0\u884c\n-p\uff1a\u7aef\u53e3\u6620\u5c04\n-v \/data\/xxx:\/data\/xx: \u5c06\u5bbf\u4e3b\u673a\u7684\u8def\u5f84\u6620\u5c04\u5230\u5bb9\u5668\u4e2d\n--name\uff1a \u5b9a\u4e49\u751f\u6210\u5bb9\u5668\u7684\u540d\u79f0<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3\u3001\u62c9\u53d6nginx<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>docker pull nginx<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4\u3001\u8fd0\u884c\u524d\u7aef\u9879\u76ee\uff0c\u751f\u6210nginx\u5bb9\u5668<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>docker run -d \n    -p 9001:9001 \n    -v \/data\/xx\/default.conf:\/etc\/nginx\/conf.d\/default.conf \n    -v \/data\/xx\/dist:\/usr\/share\/nginx\/html \n    --name nginx \n    nginx<\/code><\/pre>\n\n\n\n<p><strong>nginx\u914d\u7f6e\uff0c\u53ef\u914d\u7f6e\u63a5\u53e3\u8c03\u7528\u5730\u5740<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>server {\n    listen       80;\n    listen  &#91;::]:80;\n    server_name  localhost;\n\n    #access_log  \/var\/log\/nginx\/host.access.log  main;\n\n    location \/ {\n        root   \/usr\/share\/nginx\/html;\n        index  index.html index.htm;\n    }\n\n    #error_page  404              \/404.html;\n\n    # redirect server error pages to the static page \/50x.html\n    #\n    error_page   500 502 503 504  \/50x.html;\n    location = \/50x.html {\n        root   \/usr\/share\/nginx\/html;\n    }\n\n    # proxy the PHP scripts to Apache listening on 127.0.0.1:80\n    #\n    #location ~ \\.php$ {\n    #    proxy_pass   http:\/\/127.0.0.1;\n    #}\n\tlocation \/api\/ {\n\t\tproxy_pass http:\/\/127.0.0.1:8088\/api\/;\n\t}\n\t\n    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000\n    #\n    #location ~ \\.php$ {\n    #    root           html;\n    #    fastcgi_pass   127.0.0.1:9000;\n    #    fastcgi_index  index.php;\n    #    fastcgi_param  SCRIPT_FILENAME  \/scripts$fastcgi_script_name;\n    #    include        fastcgi_params;\n    #}\n\n    # deny access to .htaccess files, if Apache's document root\n    # concurs with nginx's one\n    #\n    #location ~ \/\\.ht {\n    #    deny  all;\n    #}\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u62c9\u53d6java\u955c\u50cf 2\u3001\u8fd0\u884cjar\u6587\u4ef6\uff0c\u751f\u6210jar\u5bb9\u5668 \u65e5\u5fd7\u67e5\u770b\uff1a 3\u3001\u62c9\u53d6nginx 4\u3001\u8fd0\u884c\u524d\u7aef\u9879\u76ee\uff0c\u751f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[11],"class_list":["post-261","post","type-post","status-publish","format-standard","hentry","category-biancheng","tag-docker"],"_links":{"self":[{"href":"https:\/\/www.wkv.cc\/index.php\/wp-json\/wp\/v2\/posts\/261","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wkv.cc\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wkv.cc\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wkv.cc\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wkv.cc\/index.php\/wp-json\/wp\/v2\/comments?post=261"}],"version-history":[{"count":2,"href":"https:\/\/www.wkv.cc\/index.php\/wp-json\/wp\/v2\/posts\/261\/revisions"}],"predecessor-version":[{"id":263,"href":"https:\/\/www.wkv.cc\/index.php\/wp-json\/wp\/v2\/posts\/261\/revisions\/263"}],"wp:attachment":[{"href":"https:\/\/www.wkv.cc\/index.php\/wp-json\/wp\/v2\/media?parent=261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wkv.cc\/index.php\/wp-json\/wp\/v2\/categories?post=261"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wkv.cc\/index.php\/wp-json\/wp\/v2\/tags?post=261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}