{"id":439144,"date":"2021-04-13T22:05:48","date_gmt":"2021-04-13T14:05:48","guid":{"rendered":"http:\/\/4563.org\/?p=439144"},"modified":"2021-04-13T22:05:48","modified_gmt":"2021-04-13T14:05:48","slug":"docker-%e7%ab%af%e5%8f%a3%e6%98%a0%e5%b0%84%e5%90%8e%e5%a4%96%e9%83%a8%e6%97%a0%e6%b3%95%e8%ae%bf%e9%97%ae","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=439144","title":{"rendered":"Docker \u7aef\u53e3\u6620\u5c04\u540e\u5916\u90e8\u65e0\u6cd5\u8bbf\u95ee"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Docker \u7aef\u53e3\u6620\u5c04\u540e\u5916\u90e8\u65e0\u6cd5\u8bbf\u95ee               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zxCoder <\/span>  <span><i><\/i> 0<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<pre><code>[email&#160;protected]:~$ docker ps CONTAINER ID   IMAGE          COMMAND            CREATED          STATUS          PORTS                    NAMES 260453d57ed9   31aa730a8cc1   \".\/Server \"   12 minutes ago   Up 12 minutes   0.0.0.0:5000-&gt;5000\/tcp   flamboyant_boyd <\/code><\/pre>\n<p>\u7136\u540e\u65e0\u6cd5\u8bbf\u95ee 5000 \u7aef\u53e3\uff0c\u663e\u793a<\/p>\n<p>\u8be5\u7f51\u9875\u65e0\u6cd5\u6b63\u5e38\u8fd0\u4f5c localhost \u672a\u53d1\u9001\u4efb\u4f55\u6570\u636e\u3002 ERR_EMPTY_RESPONSE<\/p>\n<p>\u8be5\u4ece\u54ea\u4e2a\u65b9\u5411\u53bb\u67e5\u539f\u56e0<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>15<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5753722\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : zxCoder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             docker \u662f\u5728 WSL2 \u91cc<\/p>\n<p>\u4ece WSL \u91cc\u4f3c\u4e4e\u53ef\u4ee5\u8bbf\u95ee\u7aef\u53e3\uff0c\u4f46\u662f\u5916\u90e8\u6d4f\u89c8\u5668\u4e0d\u884c<\/p>\n<p>&#8220;`<br \/>[email&#160;protected]:~$ telnet localhost 5000<br \/>Trying 127.0.0.1&#8230;<br \/>Connected to localhost.<br \/>Escape character is &#8216;^]&#8217;.<br \/>Connection closed by foreign host.<br \/>&#8220;`                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5753723\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : whitelee8080 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u770b\u4e0b\u9632\u706b\u5899 5000 \u7aef\u53e3\u662f\u5426\u5bf9\u5916\u5f00\u53d1\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5753724\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jjianwen68 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u662f\u4e0d\u662f\u8981\u67e5\u67e5\u8fd9\u4e2a container \u542f\u52a8\u7528\u7684 network                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5753725\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : abersheeran <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u4e5f\u9047\u89c1\u8fc7\uff0c\u5404\u79cd\u64cd\u4f5c\u90fd\u6ca1\u641e\u5b9a\uff0c\u8fd8\u627e\u4e86\u516c\u53f8\u91cc\u7684\u5927\u4f6c\uff0c\u90fd\u6ca1\u641e\u5b9a\u3002\u540e\u9762\u76f4\u63a5\u91cd\u88c5\u4e86\u4e00\u6b21\u7cfb\u7edf\u5c31\u597d\u4e86\u3002\u6211\u548c\u5927\u4f6c\u90fd\u731c\u6d4b\u662f\u90a3\u4e2a\u673a\u5b50\uff08\u65b0\u88c5\u7684\u7cfb\u7edf\uff09\u9632\u706b\u5899\u6709\u95ee\u9898\uff0c\u6ca1\u529e\u6cd5\u6b63\u5e38\u8f6c\u53d1\u3002<\/p>\n<p>\u53e6\uff0c\u4f60\u628a network \u6a21\u5f0f\u6539\u6210 host \u8bd5\u8bd5\u3002\u5f53\u65f6\u6211\u90a3\u4e2a\u60c5\u51b5\u4e0b\u6539\u6210\u8fd9\u4e2a\u5c31\u53ef\u4ee5\u6b63\u5e38\u4e86\u3002\u4e0d\u8fc7\u7528\u8d77\u6765\u4e0d\u723d\u6240\u4ee5\u91cd\u88c5\u4e86\u7cfb\u7edf\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5753726\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : zxCoder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5fc3\u6001\u5d29\u4e86 \u4e00\u6574\u5929\u4ee3\u7801\u6ca1\u78b0\u51e0\u884c \u5149\u662f\u641e\u4e2a\u73af\u5883\u5c31\u5feb\u4e0b\u73ed\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5753727\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : zxCoder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @whitelee8080 <br \/>@jjianwen68 <br \/>@abersheeran <\/p>\n<p>\u8bf7\u6559\u4e00\u4e2a\u95ee\u9898\uff0c\u5982\u679c docker \u542f\u52a8\u5bb9\u5668\u7ed1\u5b9a\u7aef\u53e3\uff0cdocker ps \u80fd\u663e\u793a\u7ed1\u5b9a\u7684\u7aef\u53e3\uff0c\u800c lsof -i \u4f1a\u6709\u5bf9\u5e94\u663e\u793a docker \u8fdb\u7a0b\u5417\uff1f                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5753728\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : zxCoder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @zxCoder \u8bd5\u4e86\u4e00\u4e0b \u76f4\u63a5\u5728 WSL \u91cc\u542f\u52a8\u670d\u52a1\uff0cwindows \u662f\u53ef\u4ee5\u8bbf\u95ee\u5bf9\u5e94\u7aef\u53e3\u7684\uff0c\u5982\u679c\u7528 docker \u5c31\u4e0d\u884c\u4e86\uff0c\u4e0d\u77e5\u9053\u7ed1\u5b9a\u7aef\u53e3\u54ea\u4e2a\u5730\u65b9\u51fa\u9519\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5753729\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : handsomeroger <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6267\u884c\u4e00\u4e0b\u8fd9\u4e2a\u547d\u4ee4 \u770b\u770b\u56de\u663e\u662f\u4ec0\u4e48                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5753730\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : handsomeroger <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             sysctl net.ipv4.ip_forward \u770b\u770b\u56de\u663e\u662f\u4ec0\u4e48<\/p>\n<p>\u5982\u679c net.ipv4.ip_forward \u662f 0 \u7684\u8bdd<\/p>\n<p>echo &#8216;net.ipv4.ip_forward = 1&#8217; &gt;&gt; \/usr\/lib\/sysctl.d\/50-default.conf<\/p>\n<p>sysctl -p \/usr\/lib\/sysctl.d\/50-default.conf<\/p>\n<p>\u770b\u770b\u80fd\u89e3\u51b3\u5417                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5753731\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Acoffice <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u79cd\u53ef\u80fd\u662f iptables \u89c4\u5219\u88ab\u6539\u52a8\u4e86\u5427,\u6b63\u5e38\u91cd\u542f docker \u670d\u52a1\u6216\u8005\u91cd\u542f\u673a\u5668\u80fd\u6062\u590d.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5753732\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : PerFectTime <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u670d\u52a1\u5668\u5b89\u5168\u7ec4\u5f00\u4e86\u5417                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5753733\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : PerFectTime <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53e6\u5916\u8bd5\u4e00\u4e0b 127.0.0.1                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5753734\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : zxCoder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @handsomeroger \u662f 1                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5753735\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ztxcccc <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6709\u4e9b\u8f6f\u4ef6\u57df\u540d\u5982\u679c\u662f localhost\/127.0.0.1 \u8fdb docker \u4f1a\u6709\u95ee\u9898\uff0c\u6362\u56db\u4e2a\u96f6\u8bd5\u8bd5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5753736\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : mlcq <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @ztxcccc #14 \u5bf9                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Docker \u7aef\u53e3\u6620\u5c04\u540e\u5916\u90e8\u65e0\u6cd5\u8bbf&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/439144"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=439144"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/439144\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=439144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=439144"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=439144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}