{"id":8263,"date":"2020-07-18T20:52:35","date_gmt":"2020-07-18T12:52:35","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=8263"},"modified":"2020-07-18T20:52:36","modified_gmt":"2020-07-18T12:52:36","slug":"docker-compose","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/docker-compose","title":{"rendered":"docker-compose\u547d\u4ee4 – \u5bb9\u5668\u96c6\u7fa4\u7684\u5feb\u901f\u7f16\u6392\u5de5\u5177"},"content":{"rendered":"\n
docker-compose\u547d\u4ee4\u662fDocker\u5b98\u65b9\u7684\u5f00\u6e90\u9879\u76ee\uff0c\u8d1f\u8d23\u5b9e\u73b0\u5bf9Docker\u5bb9\u5668\u96c6\u7fa4\u7684\u5feb\u901f\u7f16\u6392\uff0cdocker-compose\u5c06\u6240\u7ba1\u7406\u7684\u5bb9\u5668\u5206\u4e3a\u4e09\u5c42\uff0c\u5206\u522b\u662f\u5de5\u7a0b\uff08project\uff09\uff0c\u670d\u52a1\uff08service\uff09\u4ee5\u53ca\u5bb9\u5668\uff08container\uff09\u3002<\/p>\n\n\n\n
\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>docker-compose [\u53c2\u6570]<\/p>\n\n\n\n \u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n \u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n \u542f\u52a8\u5e76\u540e\u53f0\u8fd0\u884c\u5bb9\u5668\uff1a<\/p>\n\n\n\n \u5217\u51fa\u955c\u50cf\uff1a<\/p>\n\n\n\n \u67e5\u770b\u9879\u76ee\u4e2d\u5bb9\u5668\u65e5\u5fd7\uff1a<\/p>\n\n\n\n \u505c\u6b62\u9879\u76ee\u4e2d\u5bb9\u5668\uff1a<\/p>\n\n\n\n docker-compose\u547d\u4ee4\u662fDocker\u5b98\u65b9\u7684\u5f00\u6e90\u9879\u76ee\uff0c\u8d1f\u8d23\u5b9e\u73b0\u5bf9Docker\u5bb9\u5668\u96c6\u7fa4\u7684\u5feb\u901f\u7f16\u6392\uff0cdoc […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[11],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8263"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=8263"}],"version-history":[{"count":5,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8263\/revisions"}],"predecessor-version":[{"id":8268,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8263\/revisions\/8268"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=8263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=8263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=8263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}-f file<\/td> file\u6307\u5b9aCompose\u6a21\u677f\u6587\u4ef6\uff0c\u9ed8\u8ba4\u4e3adocker-compose.yml\uff0c\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a<\/td><\/tr> -p project-name<\/td> project-name\u6307\u5b9a\u9879\u76ee\u540d\u79f0\uff0c\u9ed8\u8ba4\u5c06\u4f7f\u7528\u6240\u5728\u76ee\u5f55\u540d\u79f0\u4f5c\u4e3a\u9879\u76ee\u540d<\/td><\/tr> up<\/td> \u542f\u52a8\u5bb9\u5668\uff0c\u7ec8\u7aef\u8fd0\u884c<\/td><\/tr> -d<\/td> \u540e\u53f0\u8fd0\u884c\u5bb9\u5668<\/td><\/tr> images<\/td> \u5217\u51fa\u955c\u50cf<\/td><\/tr> down<\/td> \u505c\u6b62\u548c\u5220\u9664\u5bb9\u5668\u3001\u7f51\u7edc\u3001\u5377\u3001\u955c\u50cf<\/td><\/tr> start<\/td> \u542f\u52a8\u9879\u76ee\u4e2d\u5bb9\u5668\uff0c\u540e\u53f0\u8fd0\u884c<\/td><\/tr> logs<\/td> \u67e5\u770b\u9879\u76ee\u4e2d\u5bb9\u5668\u65e5\u5fd7<\/td><\/tr> stop<\/td> \u505c\u6b62\u9879\u76ee\u4e2d\u5bb9\u5668<\/td><\/tr> restart<\/td> \u91cd\u542f\u9879\u76ee\u4e2d\u5bb9\u5668<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n [root@linuxcool ~]# docker-compose up -d<\/pre>\n\n\n\n
[root@linuxcool ~]# docker-compose images<\/pre>\n\n\n\n
[root@linuxcool ~]# docker-compose logs -f<\/pre>\n\n\n\n
[root@linuxcool ~]# docker-compose stop<\/pre>\n","protected":false},"excerpt":{"rendered":"