{"id":2506,"date":"2018-02-16T10:02:04","date_gmt":"2018-02-16T02:02:04","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=2506"},"modified":"2018-02-16T10:02:04","modified_gmt":"2018-02-16T02:02:04","slug":"%e9%98%ae%e4%b8%80%e5%b3%b0%ef%bc%9adocker-%e5%be%ae%e6%9c%8d%e5%8a%a1%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=2506","title":{"rendered":"\u962e\u4e00\u5cf0\uff1aDocker \u5fae\u670d\u52a1\u6559\u7a0b"},"content":{"rendered":"<p>\n\t<a href=\"https:\/\/www.xttblog.com\/?tag=docker\">Docker<\/a> \u662f\u4e00\u4e2a\u5bb9\u5668\u5de5\u5177\uff0c\u63d0\u4f9b\u865a\u62df\u73af\u5883\u3002\u5f88\u591a\u4eba\u8ba4\u4e3a\uff0c\u5b83\u6539\u53d8\u4e86\u6211\u4eec\u5bf9\u8f6f\u4ef6\u7684\u8ba4\u8bc6\u3002\n<\/p>\n<p>\n\t\u7ad9\u5728 <a href=\"https:\/\/www.xttblog.com\/?tag=docker\">Docker<\/a> \u7684\u89d2\u5ea6\uff0c\u8f6f\u4ef6\u5c31\u662f\u5bb9\u5668\u7684\u7ec4\u5408\uff1a\u4e1a\u52a1\u903b\u8f91\u5bb9\u5668\u3001\u6570\u636e\u5e93\u5bb9\u5668\u3001\u50a8\u5b58\u5bb9\u5668\u3001\u961f\u5217\u5bb9\u5668&#8230;&#8230;<a href=\"https:\/\/www.xttblog.com\/?tag=docker\">Docker<\/a> \u4f7f\u5f97\u8f6f\u4ef6\u53ef\u4ee5\u62c6\u5206\u6210\u82e5\u5e72\u4e2a\u6807\u51c6\u5316\u5bb9\u5668\uff0c\u7136\u540e\u50cf\u642d\u79ef\u6728\u4e00\u6837\u7ec4\u5408\u8d77\u6765\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\" src=\"http:\/\/www.ruanyifeng.com\/blogimg\/asset\/2018\/bg2018021306.png\" title=\"\" \/>\n<\/p>\n<p>\n\t\u8fd9\u6b63\u662f\u5fae\u670d\u52a1\uff08microservices\uff09\u7684\u601d\u60f3\uff1a\u8f6f\u4ef6\u628a\u4efb\u52a1\u5916\u5305\u51fa\u53bb\uff0c\u8ba9\u5404\u79cd\u5916\u90e8\u670d\u52a1\u5b8c\u6210\u8fd9\u4e9b\u4efb\u52a1\uff0c\u8f6f\u4ef6\u672c\u8eab\u53ea\u662f\u5e95\u5c42\u670d\u52a1\u7684\u8c03\u5ea6\u4e2d\u5fc3\u548c\u7ec4\u88c5\u5c42\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\" src=\"http:\/\/www.ruanyifeng.com\/blogimg\/asset\/2018\/bg2018021302.png\" title=\"\" \/>\n<\/p>\n<p>\n\t\u5fae\u670d\u52a1\u5f88\u9002\u5408\u7528 <a href=\"https:\/\/www.xttblog.com\/?tag=docker\">Docker<\/a> \u5bb9\u5668\u5b9e\u73b0\uff0c\u6bcf\u4e2a\u5bb9\u5668\u627f\u8f7d\u4e00\u4e2a\u670d\u52a1\u3002\u4e00\u53f0\u8ba1\u7b97\u673a\u540c\u65f6\u8fd0\u884c\u591a\u4e2a\u5bb9\u5668\uff0c\u4ece\u800c\u5c31\u80fd\u5f88\u8f7b\u677e\u5730\u6a21\u62df\u51fa\u590d\u6742\u7684\u5fae\u670d\u52a1\u67b6\u6784\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\" src=\"http:\/\/www.ruanyifeng.com\/blogimg\/asset\/2018\/bg2018021303.png\" title=\"\" \/>\n<\/p>\n<p>\n\t<a href=\"http:\/\/www.ruanyifeng.com\/blog\/2018\/02\/docker-tutorial.html\" target=\"_blank\">\u4e0a\u4e00\u7bc7\u6559\u7a0b<\/a>\u4ecb\u7ecd\u4e86 <a href=\"https:\/\/www.xttblog.com\/?tag=docker\">Docker<\/a> \u7684\u6982\u5ff5\u548c\u57fa\u672c\u7528\u6cd5\uff0c\u672c\u6587\u63a5\u7740\u5f80\u4e0b\u4ecb\u7ecd\uff0c\u5982\u4f55\u5728\u4e00\u53f0\u8ba1\u7b97\u673a\u4e0a\u5b9e\u73b0\u591a\u4e2a\u670d\u52a1\uff0c\u8ba9\u5b83\u4eec\u4e92\u76f8\u914d\u5408\uff0c\u7ec4\u5408\u51fa\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\" src=\"http:\/\/www.ruanyifeng.com\/blogimg\/asset\/2018\/bg2018021304.png\" title=\"\" \/>\n<\/p>\n<p>\n\t\u6211\u9009\u62e9\u7684\u793a\u4f8b\u8f6f\u4ef6\u662f&nbsp;<a href=\"https:\/\/wordpress.org\/\" target=\"_blank\">WordPress<\/a>\u3002\u5b83\u662f\u4e00\u4e2a\u5e38\u7528\u8f6f\u4ef6\uff0c\u5168\u4e16\u754c\u7528\u6237\u636e\u8bf4\u8d85\u8fc7\u51e0\u5343\u4e07\u3002\u540c\u65f6\u5b83\u53c8\u975e\u5e38\u7b80\u5355\uff0c\u53ea\u8981\u4e24\u4e2a\u5bb9\u5668\u5c31\u591f\u4e86\uff08\u4e1a\u52a1\u5bb9\u5668 + \u6570\u636e\u5e93\u5bb9\u5668\uff09\uff0c\u5f88\u9002\u5408\u6559\u5b66\u3002\u800c\u4e14\uff0c\u8fd9\u79cd&quot;\u4e1a\u52a1 + \u6570\u636e\u5e93&quot;\u7684\u5bb9\u5668\u67b6\u6784\uff0c\u5177\u6709\u901a\u7528\u6027\uff0c\u8bb8\u591a\u5e94\u7528\u7a0b\u5e8f\u90fd\u53ef\u4ee5\u590d\u7528\u3002\n<\/p>\n<p>\n\t\u4e3a\u4e86\u52a0\u6df1\u8bfb\u8005\u7406\u89e3\uff0c\u672c\u6587\u91c7\u7528\u4e09\u79cd\u65b9\u6cd5\uff0c\u6f14\u793a\u5982\u4f55\u67b6\u8bbe WordPress \u7f51\u7ad9\u3002\n<\/p>\n<blockquote>\n<ul>\n<li>\n\t\t\t\u65b9\u6cd5 A\uff1a\u81ea\u5efa WordPress \u5bb9\u5668\n\t\t<\/li>\n<li>\n\t\t\t\u65b9\u6cd5 B\uff1a\u91c7\u7528\u5b98\u65b9\u7684 WordPress \u5bb9\u5668\n\t\t<\/li>\n<li>\n\t\t\t\u65b9\u6cd5 C\uff1a\u91c7\u7528 <a href=\"https:\/\/www.xttblog.com\/?tag=docker\">Docker<\/a> Compose \u5de5\u5177\n\t\t<\/li>\n<\/ul>\n<\/blockquote>\n<h2>\n\t\u4e00\u3001\u9884\u5907\u5de5\u4f5c\uff1aimage \u4ed3\u5e93\u7684\u955c\u50cf\u7f51\u5740<br \/>\n<\/h2>\n<p>\n\t\u672c\u6559\u7a0b\u9700\u8981\u4ece\u4ed3\u5e93\u4e0b\u8f7d image \u6587\u4ef6\uff0c\u4f46\u662f\u56fd\u5185\u8bbf\u95ee <a href=\"https:\/\/www.xttblog.com\/?tag=docker\">Docker<\/a> \u7684\u5b98\u65b9\u4ed3\u5e93\u5f88\u6162\uff0c\u8fd8\u7ecf\u5e38\u65ad\u7ebf\uff0c\u6240\u4ee5\u8981\u628a\u4ed3\u5e93\u7f51\u5740\u6539\u6210\u56fd\u5185\u7684\u955c\u50cf\u7ad9\u3002\u8fd9\u91cc\u63a8\u8350\u4f7f\u7528\u5b98\u65b9\u955c\u50cf&nbsp;<a href=\"https:\/\/registry.docker-cn.com\/\" target=\"_blank\">registry.docker-cn.com<\/a>\u3002\n<\/p>\n<p>\n\t\u6253\u5f00<code>\/etc\/default\/docker<\/code>\u6587\u4ef6\uff08\u9700\u8981<code>sudo<\/code>\u6743\u9650\uff09\uff0c\u5728\u6587\u4ef6\u7684\u5e95\u90e8\u52a0\u4e0a\u4e00\u884c\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\nDOCKER_OPTS=&quot;--registry-mirror=<a href=\"https:\/\/registry.docker-cn.com\/\">https:\/\/registry.docker-cn.com<\/a>&quot;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u7136\u540e\uff0c\u91cd\u542f <a href=\"https:\/\/www.xttblog.com\/?tag=docker\">Docker<\/a> \u670d\u52a1\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n$ sudo service docker restart\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u73b0\u5728\u5c31\u4f1a\u81ea\u52a8\u4ece\u955c\u50cf\u4ed3\u5e93\u4e0b\u8f7d image \u6587\u4ef6\u4e86\u3002\n<\/p>\n<h2>\n\t\u4e8c\u3001\u65b9\u6cd5 A\uff1a\u81ea\u5efa WordPress \u5bb9\u5668<br \/>\n<\/h2>\n<p>\n\t\u524d\u9762\u8bf4\u8fc7\uff0c\u672c\u6587\u4f1a\u7528\u4e09\u79cd\u65b9\u6cd5\u6f14\u793a WordPress \u7684\u5b89\u88c5\u3002\u7b2c\u4e00\u79cd\u65b9\u6cd5\u5c31\u662f\u81ea\u5efa WordPress \u5bb9\u5668\u3002\n<\/p>\n<h3>\n\t2.1 \u5b98\u65b9 \u7684 PHP image<br \/>\n<\/h3>\n<p>\n\t\u9996\u5148\uff0c\u65b0\u5efa\u4e00\u4e2a\u5de5\u4f5c\u76ee\u5f55\uff0c\u5e76\u8fdb\u5165\u8be5\u76ee\u5f55\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n$ mkdir docker-demo &amp;&amp; cd docker-demo\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u7136\u540e\uff0c\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n$ docker container run \\\r\n  --rm \\\r\n  --name wordpress \\\r\n  --volume &quot;$PWD\/&quot;:\/var\/www\/html \\\r\n  php:5.6-apache\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u4e0a\u9762\u7684\u547d\u4ee4\u57fa\u4e8e<code>php<\/code>\u7684 image \u6587\u4ef6\u65b0\u5efa\u4e00\u4e2a\u5bb9\u5668\uff0c\u5e76\u4e14\u8fd0\u884c\u8be5\u5bb9\u5668\u3002<code>php<\/code>\u7684\u6807\u7b7e\u662f<code>5.6-apache<\/code>\uff0c\u8bf4\u660e\u88c5\u7684\u662f PHP 5.6\uff0c\u5e76\u4e14\u81ea\u5e26 Apache \u670d\u52a1\u5668\u3002\u8be5\u547d\u4ee4\u7684\u4e09\u4e2a\u53c2\u6570\u542b\u4e49\u5982\u4e0b\u3002\n<\/p>\n<blockquote>\n<ul>\n<li>\n\t\t\t<code>--rm<\/code>\uff1a\u505c\u6b62\u8fd0\u884c\u540e\uff0c\u81ea\u52a8\u5220\u9664\u5bb9\u5668\u6587\u4ef6\u3002\n\t\t<\/li>\n<li>\n\t\t\t<code>--name wordpress<\/code>\uff1a\u5bb9\u5668\u7684\u540d\u5b57\u53eb\u505a<code>wordpress<\/code>\u3002\n\t\t<\/li>\n<li>\n\t\t\t<code>--volume &quot;$PWD\/&quot;:\/var\/www\/html<\/code>\uff1a\u5c06\u5f53\u524d\u76ee\u5f55\uff08<code>$PWD<\/code>\uff09\u6620\u5c04\u5230\u5bb9\u5668\u7684<code>\/var\/www\/html<\/code>\uff08Apache \u5bf9\u5916\u8bbf\u95ee\u7684\u9ed8\u8ba4\u76ee\u5f55\uff09\u3002\u56e0\u6b64\uff0c\u5f53\u524d\u76ee\u5f55\u7684\u4efb\u4f55\u4fee\u6539\uff0c\u90fd\u4f1a\u53cd\u6620\u5230\u5bb9\u5668\u91cc\u9762\uff0c\u8fdb\u800c\u88ab\u5916\u90e8\u8bbf\u95ee\u5230\u3002\n\t\t<\/li>\n<\/ul>\n<\/blockquote>\n<p>\n\t\u8fd0\u884c\u4e0a\u9762\u7684\u547d\u4ee4\u4ee5\u540e\uff0c\u5982\u679c\u4e00\u5207\u6b63\u5e38\uff0c\u547d\u4ee4\u884c\u4f1a\u63d0\u793a\u5bb9\u5668\u5bf9\u5916\u7684 IP \u5730\u5740\uff0c\u8bf7\u8bb0\u4e0b\u8fd9\u4e2a\u5730\u5740\uff0c\u6211\u4eec\u8981\u7528\u5b83\u6765\u8bbf\u95ee\u5bb9\u5668\u3002\u6211\u5206\u914d\u5230\u7684 IP \u5730\u5740\u662f 172.17.0.2\u3002\n<\/p>\n<p>\n\t\u6253\u5f00\u6d4f\u89c8\u5668\uff0c\u8bbf\u95ee 172.17.0.2\uff0c\u4f60\u4f1a\u770b\u5230\u4e0b\u9762\u7684\u63d0\u793a\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\nForbidden\r\nYou don&#039;t have permission to access \/ on this server.\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u8fd9\u662f\u56e0\u4e3a\u5bb9\u5668\u7684<code>\/var\/www\/html<\/code>\u76ee\u5f55\uff08\u4e5f\u5c31\u662f\u672c\u673a\u7684<code>docker-demo<\/code>\u76ee\u5f55\uff09\u4e0b\u9762\u4ec0\u4e48\u4e5f\u6ca1\u6709\uff0c\u65e0\u6cd5\u63d0\u4f9b\u53ef\u4ee5\u8bbf\u95ee\u7684\u5185\u5bb9\u3002\n<\/p>\n<p>\n\t\u8bf7\u5728\u672c\u673a\u7684<code>docker-demo<\/code>\u76ee\u5f55\u4e0b\u9762\uff0c\u6dfb\u52a0\u4e00\u4e2a\u6700\u7b80\u5355\u7684 PHP \u6587\u4ef6<code>index.php<\/code>\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;?php \r\nphpinfo();\r\n?&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u4fdd\u5b58\u4ee5\u540e\uff0c\u6d4f\u89c8\u5668\u5237\u65b0<code>172.17.0.2<\/code>\uff0c\u5e94\u8be5\u5c31\u4f1a\u770b\u5230\u719f\u6089\u7684<code>phpinfo<\/code>\u9875\u9762\u4e86\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\" src=\"http:\/\/www.ruanyifeng.com\/blogimg\/asset\/2018\/bg2018021305.jpg\" title=\"\" \/>\n<\/p>\n<h3>\n\t2.2 \u62f7\u8d1d WordPress \u5b89\u88c5\u5305<br \/>\n<\/h3>\n<p>\n\t\u65e2\u7136\u672c\u5730\u7684<code>docker-demo<\/code>\u76ee\u5f55\u53ef\u4ee5\u6620\u5c04\u5230\u5bb9\u5668\u91cc\u9762\uff0c\u90a3\u4e48\u628a WordPress \u5b89\u88c5\u5305\u62f7\u8d1d\u5230<code>docker-demo<\/code>\u76ee\u5f55\u4e0b\uff0c\u4e0d\u5c31\u53ef\u4ee5\u901a\u8fc7\u5bb9\u5668\u8bbf\u95ee\u5230 WordPress \u7684\u5b89\u88c5\u754c\u9762\u4e86\u5417\uff1f\n<\/p>\n<p>\n\t\u9996\u5148\uff0c\u5728<code>docker-demo<\/code>\u76ee\u5f55\u4e0b\uff0c\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\uff0c\u6293\u53d6\u5e76\u89e3\u538b WordPress \u5b89\u88c5\u5305\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n$ wget https:\/\/cn.wordpress.org\/wordpress-4.9.4-zh_CN.tar.gz\r\n$ tar -xvf wordpress-4.9.4-zh_CN.tar.gz\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u89e3\u538b\u4ee5\u540e\uff0cWordPress \u7684\u5b89\u88c5\u6587\u4ef6\u4f1a\u5728<code>docker-demo\/wordpress<\/code>\u76ee\u5f55\u4e0b\u3002\n<\/p>\n<p>\n\t\u8fd9\u65f6\u6d4f\u89c8\u5668\u8bbf\u95ee<code>http:\/\/172.17.0.2\/wordpress<\/code>\uff0c\u5c31\u80fd\u770b\u5230 WordPress \u7684\u5b89\u88c5\u63d0\u793a\u4e86\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\" src=\"http:\/\/www.ruanyifeng.com\/blogimg\/asset\/2018\/bg2018021307.png\" title=\"\" \/>\n<\/p>\n<h3>\n\t2.3 \u5b98\u65b9\u7684 MySQL \u5bb9\u5668<br \/>\n<\/h3>\n<p>\n\tWordPress \u5fc5\u987b\u6709\u6570\u636e\u5e93\u624d\u80fd\u5b89\u88c5\uff0c\u6240\u4ee5\u5fc5\u987b\u65b0\u5efa MySQL \u5bb9\u5668\u3002\n<\/p>\n<p>\n\t\u6253\u5f00\u4e00\u4e2a\u65b0\u7684\u547d\u4ee4\u884c\u7a97\u53e3\uff0c\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n$ docker container run \\\r\n  -d \\\r\n  --rm \\\r\n  --name wordpressdb \\\r\n  --env MYSQL_ROOT_PASSWORD=123456 \\\r\n  --env MYSQL_DATABASE=wordpress \\\r\n  mysql:5.7\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u4e0a\u9762\u7684\u547d\u4ee4\u4f1a\u57fa\u4e8e MySQL \u7684 image \u6587\u4ef6\uff085.7\u7248\u672c\uff09\u65b0\u5efa\u4e00\u4e2a\u5bb9\u5668\u3002\u8be5\u547d\u4ee4\u7684\u4e94\u4e2a\u547d\u4ee4\u884c\u53c2\u6570\u7684\u542b\u4e49\u5982\u4e0b\u3002\n<\/p>\n<blockquote>\n<ul>\n<li>\n\t\t\t<code>-d<\/code>\uff1a\u5bb9\u5668\u542f\u52a8\u540e\uff0c\u5728\u540e\u53f0\u8fd0\u884c\u3002\n\t\t<\/li>\n<li>\n\t\t\t<code>--rm<\/code>\uff1a\u5bb9\u5668\u7ec8\u6b62\u8fd0\u884c\u540e\uff0c\u81ea\u52a8\u5220\u9664\u5bb9\u5668\u6587\u4ef6\u3002\n\t\t<\/li>\n<li>\n\t\t\t<code>--name wordpressdb<\/code>\uff1a\u5bb9\u5668\u7684\u540d\u5b57\u53eb\u505a<code>wordpressdb<\/code>\n\t\t<\/li>\n<li>\n\t\t\t<code>--env MYSQL_ROOT_PASSWORD=123456<\/code>\uff1a\u5411\u5bb9\u5668\u8fdb\u7a0b\u4f20\u5165\u4e00\u4e2a\u73af\u5883\u53d8\u91cf<code>MYSQL_ROOT_PASSWORD<\/code>\uff0c\u8be5\u53d8\u91cf\u4f1a\u88ab\u7528\u4f5c MySQL \u7684\u6839\u5bc6\u7801\u3002\n\t\t<\/li>\n<li>\n\t\t\t<code>--env MYSQL_DATABASE=wordpress<\/code>\uff1a\u5411\u5bb9\u5668\u8fdb\u7a0b\u4f20\u5165\u4e00\u4e2a\u73af\u5883\u53d8\u91cf<code>MYSQL_DATABASE<\/code>\uff0c\u5bb9\u5668\u91cc\u9762\u7684 MySQL \u4f1a\u6839\u636e\u8be5\u53d8\u91cf\u521b\u5efa\u4e00\u4e2a\u540c\u540d\u6570\u636e\u5e93\uff08\u672c\u4f8b\u662f<code>WordPress<\/code>\uff09\u3002\n\t\t<\/li>\n<\/ul>\n<\/blockquote>\n<p>\n\t\u8fd0\u884c\u4e0a\u9762\u7684\u547d\u4ee4\u4ee5\u540e\uff0c\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0c\u547d\u4ee4\u884c\u4f1a\u663e\u793a\u4e00\u884c\u5b57\u7b26\u4e32\uff0c\u8fd9\u662f\u5bb9\u5668\u7684 ID\uff0c\u8868\u793a\u5df2\u7ecf\u65b0\u5efa\u6210\u529f\u4e86\u3002\n<\/p>\n<p>\n\t\u8fd9\u65f6\uff0c\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u67e5\u770b\u6b63\u5728\u8fd0\u884c\u7684\u5bb9\u5668\uff0c\u4f60\u5e94\u8be5\u770b\u5230<code>wordpress<\/code>\u548c<code>wordpressdb<\/code>\u4e24\u4e2a\u5bb9\u5668\u6b63\u5728\u8fd0\u884c\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n$ docker container ls\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u5176\u4e2d\uff0c<code>wordpressdb<\/code>\u662f\u540e\u53f0\u8fd0\u884c\u7684\uff0c\u524d\u53f0\u770b\u4e0d\u89c1\u5b83\u7684\u8f93\u51fa\uff0c\u5fc5\u987b\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u67e5\u770b\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n$ docker container logs wordpressdb\r\n<\/code><\/pre>\n<\/blockquote>\n<h3>\n\t2.4 \u5b9a\u5236 PHP \u5bb9\u5668<br \/>\n<\/h3>\n<p>\n\t\u73b0\u5728 WordPress \u5bb9\u5668\u548c MySQL \u5bb9\u5668\u90fd\u5df2\u7ecf\u6709\u4e86\u3002\u63a5\u4e0b\u6765\uff0c\u8981\u628a WordPress \u5bb9\u5668\u8fde\u63a5\u5230 MySQL \u5bb9\u5668\u4e86\u3002\u4f46\u662f\uff0cPHP \u7684\u5b98\u65b9 image \u4e0d\u5e26\u6709<code>mysql<\/code>\u6269\u5c55\uff0c\u5fc5\u987b\u81ea\u5df1\u65b0\u5efa image \u6587\u4ef6\u3002\n<\/p>\n<p>\n\t\u9996\u5148\uff0c\u505c\u6389 WordPress \u5bb9\u5668\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n$ docker container stop wordpress\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u505c\u6389\u4ee5\u540e\uff0c\u7531\u4e8e<code>--rm<\/code>\u53c2\u6570\u7684\u4f5c\u7528\uff0c\u8be5\u5bb9\u5668\u6587\u4ef6\u4f1a\u88ab\u81ea\u52a8\u5220\u9664\u3002\n<\/p>\n<p>\n\t\u7136\u540e\uff0c\u5728<code>docker-demo<\/code>\u76ee\u5f55\u91cc\u9762\uff0c\u65b0\u5efa\u4e00\u4e2a<code>Dockerfile<\/code>\u6587\u4ef6\uff0c\u5199\u5165\u4e0b\u9762\u7684\u5185\u5bb9\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\nFROM php:5.6-apache\r\nRUN docker-php-ext-install mysqli\r\nCMD apache2-foreground\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u4e0a\u9762\u4ee3\u7801\u7684\u610f\u601d\uff0c\u5c31\u662f\u5728\u539f\u6765 PHP \u7684 image \u57fa\u7840\u4e0a\uff0c\u5b89\u88c5<code>mysqli<\/code>\u7684\u6269\u5c55\u3002\u7136\u540e\uff0c\u542f\u52a8 Apache\u3002\n<\/p>\n<p>\n\t\u57fa\u4e8e\u8fd9\u4e2a Dockerfile \u6587\u4ef6\uff0c\u65b0\u5efa\u4e00\u4e2a\u540d\u4e3a<code>phpwithmysql<\/code>\u7684 image \u6587\u4ef6\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n$ docker build -t phpwithmysql .\r\n<\/code><\/pre>\n<\/blockquote>\n<h3>\n\t2.5 WordPress \u5bb9\u5668\u8fde\u63a5 MySQL<br \/>\n<\/h3>\n<p>\n\t\u73b0\u5728\u57fa\u4e8e phpwithmysql image\uff0c\u91cd\u65b0\u65b0\u5efa\u4e00\u4e2a WordPress \u5bb9\u5668\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n$ docker container run \\\r\n  --rm \\\r\n  --name wordpress \\\r\n  --volume &quot;$PWD\/&quot;:\/var\/www\/html \\\r\n  --link wordpressdb:mysql \\\r\n  phpwithmysql\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u8ddf\u4e0a\u4e00\u6b21\u76f8\u6bd4\uff0c\u4e0a\u9762\u7684\u547d\u4ee4\u591a\u4e86\u4e00\u4e2a\u53c2\u6570<code>--link wordpressdb:mysql<\/code>\uff0c\u8868\u793a WordPress \u5bb9\u5668\u8981\u8fde\u5230<code>wordpressdb<\/code>\u5bb9\u5668\uff0c\u5192\u53f7\u8868\u793a\u8be5\u5bb9\u5668\u7684\u522b\u540d\u662f<code>mysql<\/code>\u3002\n<\/p>\n<p>\n\t\u8fd9\u65f6\u8fd8\u8981\u6539\u4e00\u4e0b<code>wordpress<\/code>\u76ee\u5f55\u7684\u6743\u9650\uff0c\u8ba9\u5bb9\u5668\u53ef\u4ee5\u5c06\u914d\u7f6e\u4fe1\u606f\u5199\u5165\u8fd9\u4e2a\u76ee\u5f55\uff08\u5bb9\u5668\u5185\u90e8\u5199\u5165\u7684<code>\/var\/www\/html<\/code>\u76ee\u5f55\uff0c\u4f1a\u6620\u5c04\u5230\u8fd9\u4e2a\u76ee\u5f55\uff09\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n$ chmod -R 777 wordpress\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u63a5\u7740\uff0c\u56de\u5230\u6d4f\u89c8\u5668\u7684<code>http:\/\/172.17.0.2\/wordpress<\/code>\u9875\u9762\uff0c\u70b9\u51fb&quot;\u73b0\u5728\u5c31\u5f00\u59cb\uff01&quot;\u6309\u94ae\uff0c\u5f00\u59cb\u5b89\u88c5\u3002\n<\/p>\n<p>\n\tWordPress \u63d0\u793a\u8981\u8f93\u5165\u6570\u636e\u5e93\u53c2\u6570\u3002\u8f93\u5165\u7684\u53c2\u6570\u5982\u4e0b\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\" src=\"http:\/\/www.ruanyifeng.com\/blogimg\/asset\/2018\/bg2018021308.png\" title=\"\" \/>\n<\/p>\n<blockquote>\n<ul>\n<li>\n\t\t\t\u6570\u636e\u5e93\u540d\uff1a<code>wordpress<\/code>\n\t\t<\/li>\n<li>\n\t\t\t\u7528\u6237\u540d\uff1a<code>root<\/code>\n\t\t<\/li>\n<li>\n\t\t\t\u5bc6\u7801\uff1a<code>123456<\/code>\n\t\t<\/li>\n<li>\n\t\t\t\u6570\u636e\u5e93\u4e3b\u673a\uff1a<code>mysql<\/code>\n\t\t<\/li>\n<li>\n\t\t\t\u8868\u524d\u7f00\uff1a<code>wp_<\/code>\uff08\u4e0d\u53d8\uff09\n\t\t<\/li>\n<\/ul>\n<\/blockquote>\n<p>\n\t\u70b9\u51fb&quot;\u4e0b\u4e00\u6b65&quot;\u6309\u94ae\uff0c\u5982\u679c WordPress \u8fde\u63a5\u6570\u636e\u5e93\u6210\u529f\uff0c\u5c31\u4f1a\u51fa\u73b0\u4e0b\u9762\u7684\u9875\u9762\uff0c\u8fd9\u5c31\u8868\u793a\u53ef\u4ee5\u5b89\u88c5\u4e86\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\" src=\"http:\/\/www.ruanyifeng.com\/blogimg\/asset\/2018\/bg2018021309.png\" title=\"\" \/>\n<\/p>\n<p>\n\t\u81f3\u6b64\uff0c\u81ea\u5efa WordPress \u5bb9\u5668\u7684\u6f14\u793a\u5b8c\u6bd5\uff0c\u53ef\u4ee5\u628a\u6b63\u5728\u8fd0\u884c\u7684\u4e24\u4e2a\u5bb9\u5668\u5173\u95ed\u4e86\uff08\u5bb9\u5668\u6587\u4ef6\u4f1a\u81ea\u52a8\u5220\u9664\uff09\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n$ docker container stop wordpress wordpressdb\r\n<\/code><\/pre>\n<\/blockquote>\n<h2>\n\t\u4e09\u3001\u65b9\u6cd5 B\uff1aWordpress \u5b98\u65b9\u955c\u50cf<br \/>\n<\/h2>\n<p>\n\t\u4e0a\u4e00\u90e8\u5206\u7684\u81ea\u5efa WordPress \u5bb9\u5668\uff0c\u8fd8\u662f\u633a\u9ebb\u70e6\u7684\u3002\u5176\u5b9e\u4e0d\u7528\u8fd9\u4e48\u9ebb\u70e6\uff0cDocker \u5df2\u7ecf\u63d0\u4f9b\u4e86\u5b98\u65b9&nbsp;<a href=\"https:\/\/hub.docker.com\/_\/wordpress\/\" target=\"_blank\">WordPress<\/a>image\uff0c\u76f4\u63a5\u7528\u90a3\u4e2a\u5c31\u53ef\u4ee5\u4e86\u3002\u6709\u4e86\u4e0a\u4e00\u90e8\u5206\u7684\u57fa\u7840\uff0c\u4e0b\u9762\u7684\u64cd\u4f5c\u5c31\u5f88\u5bb9\u6613\u7406\u89e3\u4e86\u3002\n<\/p>\n<h3>\n\t3.1 \u57fa\u672c\u7528\u6cd5<br \/>\n<\/h3>\n<p>\n\t\u9996\u5148\uff0c\u65b0\u5efa\u5e76\u542f\u52a8 MySQL \u5bb9\u5668\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n$ docker container run \\\r\n  -d \\\r\n  --rm \\\r\n  --name wordpressdb \\\r\n  --env MYSQL_ROOT_PASSWORD=123456 \\\r\n  --env MYSQL_DATABASE=wordpress \\\r\n  mysql:5.7\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u7136\u540e\uff0c\u57fa\u4e8e\u5b98\u65b9\u7684 WordPress image\uff0c\u65b0\u5efa\u5e76\u542f\u52a8 WordPress \u5bb9\u5668\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n$ docker container run \\\r\n  -d \\\r\n  --rm \\\r\n  --name wordpress \\\r\n  --env WORDPRESS_DB_PASSWORD=123456 \\\r\n  --link wordpressdb:mysql \\\r\n  wordpress\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u4e0a\u9762\u547d\u4ee4\u4e2d\uff0c\u5404\u4e2a\u53c2\u6570\u7684\u542b\u4e49\u524d\u9762\u90fd\u89e3\u91ca\u8fc7\u4e86\uff0c\u5176\u4e2d\u73af\u5883\u53d8\u91cf<code>WORDPRESS_DB_PASSWORD<\/code>\u662f MySQL \u5bb9\u5668\u7684\u6839\u5bc6\u7801\u3002\n<\/p>\n<p>\n\t\u4e0a\u9762\u547d\u4ee4\u6307\u5b9a<code>wordpress<\/code>\u5bb9\u5668\u5728\u540e\u53f0\u8fd0\u884c\uff0c\u5bfc\u81f4\u524d\u53f0\u770b\u4e0d\u89c1\u8f93\u51fa\uff0c\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u67e5\u51fa<code>wordpress<\/code>\u5bb9\u5668\u7684 IP \u5730\u5740\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n$ docker container inspect wordpress\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u4e0a\u9762\u547d\u4ee4\u8fd0\u884c\u4ee5\u540e\uff0c\u4f1a\u8f93\u51fa\u5f88\u591a\u5185\u5bb9\uff0c\u627e\u5230<code>IPAddress<\/code>\u5b57\u6bb5\u5373\u53ef\u3002\u6211\u7684\u673a\u5668\u8fd4\u56de\u7684 IP \u5730\u5740\u662f<code>172.17.0.3<\/code>\u3002\n<\/p>\n<p>\n\t\u6d4f\u89c8\u5668\u8bbf\u95ee<code>172.17.0.3<\/code>\uff0c\u5c31\u4f1a\u770b\u5230 WordPress \u7684\u5b89\u88c5\u63d0\u793a\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\" src=\"http:\/\/www.ruanyifeng.com\/blogimg\/asset\/2018\/bg2018021310.png\" title=\"\" \/>\n<\/p>\n<h3>\n\t3.2 WordPress \u5bb9\u5668\u7684\u5b9a\u5236<br \/>\n<\/h3>\n<p>\n\t\u5230\u4e86\u4e0a\u4e00\u6b65\uff0c\u5b98\u65b9 WordPress \u5bb9\u5668\u7684\u5b89\u88c5\u5c31\u5df2\u7ecf\u6210\u529f\u4e86\u3002\u4f46\u662f\uff0c\u8fd9\u79cd\u65b9\u6cd5\u6709\u4e24\u4e2a\u5f88\u4e0d\u65b9\u4fbf\u7684\u5730\u65b9\u3002\n<\/p>\n<blockquote>\n<ul>\n<li>\n\t\t\t\u6bcf\u6b21\u65b0\u5efa\u5bb9\u5668\uff0c\u8fd4\u56de\u7684 IP \u5730\u5740\u4e0d\u80fd\u4fdd\u8bc1\u76f8\u540c\uff0c\u5bfc\u81f4\u8981\u66f4\u6362 IP \u5730\u5740\u8bbf\u95ee WordPress\u3002\n\t\t<\/li>\n<li>\n\t\t\tWordPress \u5b89\u88c5\u5728\u5bb9\u5668\u91cc\u9762\uff0c\u672c\u5730\u65e0\u6cd5\u4fee\u6539\u6587\u4ef6\u3002\n\t\t<\/li>\n<\/ul>\n<\/blockquote>\n<p>\n\t\u89e3\u51b3\u8fd9\u4e24\u4e2a\u95ee\u9898\u5f88\u5bb9\u6613\uff0c\u53ea\u8981\u65b0\u5efa\u5bb9\u5668\u7684\u65f6\u5019\uff0c\u52a0\u4e24\u4e2a\u547d\u4ee4\u884c\u53c2\u6570\u5c31\u53ef\u4ee5\u4e86\u3002\n<\/p>\n<p>\n\t\u5148\u628a\u521a\u624d\u542f\u52a8\u7684 WordPress \u5bb9\u5668\u7ec8\u6b62\uff08\u5bb9\u5668\u6587\u4ef6\u4f1a\u81ea\u52a8\u5220\u9664\uff09\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n$ docker container stop wordpress\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u7136\u540e\uff0c\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u65b0\u5efa\u5e76\u542f\u52a8 WordPress \u5bb9\u5668\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n $ docker container run \\\r\n  -d \\\r\n  -p 127.0.0.2:8080:80 \\\r\n  --rm \\\r\n  --name wordpress \\\r\n  --env WORDPRESS_DB_PASSWORD=123456 \\\r\n  --link wordpressdb:mysql \\\r\n  --volume &quot;$PWD\/wordpress&quot;:\/var\/www\/html \\\r\n  wordpress\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u4e0a\u9762\u7684\u547d\u4ee4\u8ddf\u524d\u9762\u76f8\u6bd4\uff0c\u547d\u4ee4\u884c\u53c2\u6570\u53ea\u591a\u51fa\u4e86\u4e24\u4e2a\u3002\n<\/p>\n<blockquote>\n<ul>\n<li>\n\t\t\t<code>-p 127.0.0.2:8080:80<\/code>\uff1a\u5c06\u5bb9\u5668\u7684 80 \u7aef\u53e3\u6620\u5c04\u5230<code>127.0.0.2<\/code>\u7684<code>8080<\/code>\u7aef\u53e3\u3002\n\t\t<\/li>\n<li>\n\t\t\t<code>--volume &quot;$PWD\/wordpress&quot;:\/var\/www\/html<\/code>\uff1a\u5c06\u5bb9\u5668\u7684<code>\/var\/www\/html<\/code>\u76ee\u5f55\u6620\u5c04\u5230\u5f53\u524d\u76ee\u5f55\u7684<code>wordpress<\/code>\u5b50\u76ee\u5f55\u3002\n\t\t<\/li>\n<\/ul>\n<\/blockquote>\n<p>\n\t\u6d4f\u89c8\u5668\u8bbf\u95ee<code>127.0.0.2:8080:80<\/code>\u5c31\u80fd\u770b\u5230 WordPress \u7684\u5b89\u88c5\u63d0\u793a\u4e86\u3002\u800c\u4e14\uff0c\u4f60\u5728<code>wordpress<\/code>\u5b50\u76ee\u5f55\u4e0b\u7684\u6bcf\u6b21\u4fee\u6539\uff0c\u90fd\u4f1a\u53cd\u6620\u5230\u5bb9\u5668\u91cc\u9762\u3002\n<\/p>\n<p>\n\t\u6700\u540e\uff0c\u7ec8\u6b62\u8fd9\u4e24\u4e2a\u5bb9\u5668\uff08\u5bb9\u5668\u6587\u4ef6\u4f1a\u81ea\u52a8\u5220\u9664\uff09\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n$ docker container stop wordpress wordpressdb\r\n<\/code><\/pre>\n<\/blockquote>\n<h2>\n\t\u56db\u3001\u65b9\u6cd5 C\uff1aDocker Compose \u5de5\u5177<br \/>\n<\/h2>\n<p>\n\t\u4e0a\u9762\u7684\u65b9\u6cd5 B \u5df2\u7ecf\u633a\u7b80\u5355\u4e86\uff0c\u4f46\u662f\u5fc5\u987b\u81ea\u5df1\u5206\u522b\u542f\u52a8\u4e24\u4e2a\u5bb9\u5668\uff0c\u542f\u52a8\u7684\u65f6\u5019\uff0c\u8fd8\u8981\u5728\u547d\u4ee4\u884c\u63d0\u4f9b\u5bb9\u5668\u4e4b\u95f4\u7684\u8fde\u63a5\u4fe1\u606f\u3002\u56e0\u6b64\uff0cDocker \u63d0\u4f9b\u4e86\u4e00\u79cd\u66f4\u7b80\u5355\u7684\u65b9\u6cd5\uff0c\u6765\u7ba1\u7406\u591a\u4e2a\u5bb9\u5668\u7684\u8054\u52a8\u3002\n<\/p>\n<h3>\n\t4.1 Docker Compose \u7b80\u4ecb<br \/>\n<\/h3>\n<p>\n\t<img decoding=\"async\" alt=\"\" src=\"http:\/\/www.ruanyifeng.com\/blogimg\/asset\/2018\/bg2018021311.jpg\" title=\"\" \/>\n<\/p>\n<p>\n\t<a href=\"https:\/\/docs.docker.com\/compose\/\" target=\"_blank\">Compose<\/a>&nbsp;\u662f Docker \u516c\u53f8\u63a8\u51fa\u7684\u4e00\u4e2a\u5de5\u5177\u8f6f\u4ef6\uff0c\u53ef\u4ee5\u7ba1\u7406\u591a\u4e2a Docker \u5bb9\u5668\u7ec4\u6210\u4e00\u4e2a\u5e94\u7528\u3002\u4f60\u9700\u8981\u5b9a\u4e49\u4e00\u4e2a&nbsp;<a href=\"http:\/\/www.ruanyifeng.com\/blog\/2016\/07\/yaml.html\" target=\"_blank\">YAML<\/a>&nbsp;\u683c\u5f0f\u7684\u914d\u7f6e\u6587\u4ef6<code>docker-compose.yml<\/code>\uff0c\u5199\u597d\u591a\u4e2a\u5bb9\u5668\u4e4b\u95f4\u7684\u8c03\u7528\u5173\u7cfb\u3002\u7136\u540e\uff0c\u53ea\u8981\u4e00\u4e2a\u547d\u4ee4\uff0c\u5c31\u80fd\u540c\u65f6\u542f\u52a8\/\u5173\u95ed\u8fd9\u4e9b\u5bb9\u5668\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n# \u542f\u52a8\u6240\u6709\u670d\u52a1\r\n$ docker-compose up\r\n# \u5173\u95ed\u6240\u6709\u670d\u52a1\r\n$ docker-compose stop\r\n<\/code><\/pre>\n<\/blockquote>\n<h3>\n\t4.2 Docker Compose \u7684\u5b89\u88c5<br \/>\n<\/h3>\n<p>\n\tMac \u548c Windows \u5728\u5b89\u88c5 docker \u7684\u65f6\u5019\uff0c\u4f1a\u4e00\u8d77\u5b89\u88c5 docker compose\u3002Linux \u7cfb\u7edf\u4e0b\u7684\u5b89\u88c5\u53c2\u8003<a href=\"https:\/\/docs.docker.com\/compose\/install\/#install-compose\" target=\"_blank\">\u5b98\u65b9\u6587\u6863<\/a>\u3002\n<\/p>\n<p>\n\t\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u8fd0\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n$ docker-compose --version\r\n<\/code><\/pre>\n<\/blockquote>\n<h3>\n\t4.3 WordPress \u793a\u4f8b<br \/>\n<\/h3>\n<p>\n\t\u5728<code>docker-demo<\/code>\u76ee\u5f55\u4e0b\uff0c\u65b0\u5efa<code>docker-compose.yml<\/code>\u6587\u4ef6\uff0c\u5199\u5165\u4e0b\u9762\u7684\u5185\u5bb9\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\nmysql:\r\n    image: mysql:5.7\r\n    environment:\r\n     - MYSQL_ROOT_PASSWORD=123456\r\n     - MYSQL_DATABASE=wordpress\r\nweb:\r\n    image: wordpress\r\n    links:\r\n     - mysql\r\n    environment:\r\n     - WORDPRESS_DB_PASSWORD=123456\r\n    ports:\r\n     - &quot;127.0.0.3:8080:80&quot;\r\n    working_dir: \/var\/www\/html\r\n    volumes:\r\n     - wordpress:\/var\/www\/html\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u4e0a\u9762\u4ee3\u7801\u4e2d\uff0c\u4e24\u4e2a\u9876\u5c42\u6807\u7b7e\u8868\u793a\u6709\u4e24\u4e2a\u5bb9\u5668<code>mysql<\/code>\u548c<code>web<\/code>\u3002\u6bcf\u4e2a\u5bb9\u5668\u7684\u5177\u4f53\u8bbe\u7f6e\uff0c\u524d\u9762\u90fd\u5df2\u7ecf\u8bb2\u89e3\u8fc7\u4e86\uff0c\u8fd8\u662f\u633a\u5bb9\u6613\u7406\u89e3\u7684\u3002\n<\/p>\n<p>\n\t\u542f\u52a8\u4e24\u4e2a\u5bb9\u5668\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n$ docker-compose up\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u6d4f\u89c8\u5668\u8bbf\u95ee http:\/\/127.0.0.3:8080\uff0c\u5e94\u8be5\u5c31\u80fd\u770b\u5230 WordPress \u7684\u5b89\u88c5\u754c\u9762\u3002\n<\/p>\n<p>\n\t\u73b0\u5728\u5173\u95ed\u4e24\u4e2a\u5bb9\u5668\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n$ docker-compose stop\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u5173\u95ed\u4ee5\u540e\uff0c\u8fd9\u4e24\u4e2a\u5bb9\u5668\u6587\u4ef6\u8fd8\u662f\u5b58\u5728\u7684\uff0c\u5199\u5728\u91cc\u9762\u7684\u6570\u636e\u4e0d\u4f1a\u4e22\u5931\u3002\u4e0b\u6b21\u542f\u52a8\u7684\u65f6\u5019\uff0c\u8fd8\u53ef\u4ee5\u590d\u7528\u3002\u4e0b\u9762\u7684\u547d\u4ee4\u53ef\u4ee5\u628a\u8fd9\u4e24\u4e2a\u5bb9\u5668\u6587\u4ef6\u5220\u9664\uff08\u5bb9\u5668\u5fc5\u987b\u5df2\u7ecf\u505c\u6b62\u8fd0\u884c\uff09\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n$ docker-compose rm\r\n<\/code><\/pre>\n<\/blockquote>\n<h2>\n\t\u4e94\u3001\u53c2\u8003\u94fe\u63a5<br \/>\n<\/h2>\n<ul>\n<li>\n\t\t<a href=\"https:\/\/www.sitepoint.com\/how-to-manually-build-docker-containers-for-wordpress\/\" target=\"_blank\">How to Manually Build Docker Containers for WordPress<\/a>, by Aleksander Koko\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/www.sitepoint.com\/how-to-use-the-official-docker-wordpress-image\/\" target=\"_blank\">How to Use the Official Docker WordPress Image<\/a>, by Aleksander Koko\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/www.sitepoint.com\/deploying-wordpress-with-docker\/\" target=\"_blank\">Deploying WordPress with Docker<\/a>, by Aleksander Koko\n\t<\/li>\n<li>\n\t\t<a href=\"http:\/\/www.ruanyifeng.com\/blog\/2018\/02\/docker-wordpress-tutorial.html\" name=\"Docker \u5fae\u670d\u52a1\u6559\u7a0b\" target=\"_blank\" title=\"Docker \u5fae\u670d\u52a1\u6559\u7a0b\">Docker \u5fae\u670d\u52a1\u6559\u7a0b<\/a>\n\t<\/li>\n<\/ul>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=2506\">\u962e\u4e00\u5cf0\uff1aDocker \u5fae\u670d\u52a1\u6559\u7a0b<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>Docker \u662f\u4e00\u4e2a\u5bb9\u5668\u5de5\u5177\uff0c\u63d0\u4f9b\u865a\u62df\u73af\u5883\u3002\u5f88\u591a\u4eba\u8ba4\u4e3a\uff0c\u5b83\u6539\u53d8\u4e86\u6211\u4eec\u5bf9\u8f6f\u4ef6\u7684\u8ba4\u8bc6\u3002 \u7ad9\u5728 Docker \u7684\u89d2\u5ea6 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[118,6],"tags":[512,83,1419,651,25],"class_list":["post-2506","post","type-post","status-publish","format-standard","hentry","category-ndisdevelop","category-yyzt","tag-docker","tag-mysql","tag-php","tag-wordpress","tag-25"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2506","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2506"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2506\/revisions"}],"predecessor-version":[{"id":2507,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2506\/revisions\/2507"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2506"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2506"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2506"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}