{"id":1890,"date":"2020-10-12T18:03:16","date_gmt":"2020-10-12T09:03:16","guid":{"rendered":"https:\/\/knowhow.hirohiro716.com\/?p=1890"},"modified":"2021-10-20T17:22:39","modified_gmt":"2021-10-20T08:22:39","slug":"docker-compose%e3%81%a7php%e3%81%a8mysql%e3%81%ae%e9%96%8b%e7%99%ba%e7%92%b0%e5%a2%83%e3%82%92%e4%bd%9c%e3%82%8b","status":"publish","type":"post","link":"https:\/\/weblog.hirohiro716.com\/?p=1890","title":{"rendered":"docker-compose\u3067PHP\u3068MySQL\u306e\u958b\u767a\u74b0\u5883\u3092\u4f5c\u308b"},"content":{"rendered":"<p>docker\u3068docker-compose\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# apt install docker.io docker-compose\r\n<\/pre>\n<p>\u4e0b\u8a18\u306eyml\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n<pre class=\"brush: plain; title: \/home\/user\/docker\/test\/docker-compose.yml; notranslate\" title=\"\/home\/user\/docker\/test\/docker-compose.yml\">\r\nversion: '3'\r\n\r\nservices:\r\n    php:\r\n        image: php:7.3-apache\r\n        volumes: \r\n            - \/home\/user\/docker\/test\/www:\/var\/www\/html\r\n        ports:\r\n            - &quot;80:80&quot;\r\n        container_name: test-php\r\n    mysql:\r\n        image: mysql:5.7\r\n        command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_bin\r\n        volumes:\r\n            - \/home\/user\/docker\/test\/mysql:\/var\/lib\/mysql\r\n        ports:\r\n            - &quot;3306:3306&quot;\r\n        environment: \r\n            MYSQL_ROOT_PASSWORD: rootpassword\r\n            MYSQL_DATABASE: test\r\n            MYSQL_USER: test\r\n            MYSQL_PASSWORD: password\r\n        container_name: test-mysql\r\n<\/pre>\n<p>\u30b3\u30f3\u30c6\u30ca\u3092\u4f5c\u6210\u3057\u3066\u8d77\u52d5\u3059\u308b\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# cd \/home\/user\/docker\/test\/\r\n# docker-compose up -d\r\n<\/pre>\n<p>\u4f5c\u6210\u6e08\u307f\u306e\u30b3\u30f3\u30c6\u30ca\u3092\u8d77\u52d5\u3059\u308b\u3002<br \/>\n\u203bdocker-compose.yml\u304c\u5b58\u5728\u3059\u308b\u5834\u6240\u3067\u5b9f\u884c\u3059\u308b<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# docker-compose start\r\n<\/pre>\n<p>\u4f5c\u6210\u6e08\u307f\u306e\u30b3\u30f3\u30c6\u30ca\u3092\u505c\u6b62\u3059\u308b\u3002<br \/>\n\u203bdocker-compose.yml\u304c\u5b58\u5728\u3059\u308b\u5834\u6240\u3067\u5b9f\u884c\u3059\u308b<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# docker-compose stop\r\n<\/pre>\n<p>\u30b3\u30f3\u30c6\u30ca\u3092\u505c\u6b62\u3057\u3066\u524a\u9664\u3059\u308b\u3002<br \/>\n\u203bdocker-compose.yml\u304c\u5b58\u5728\u3059\u308b\u5834\u6240\u3067\u5b9f\u884c\u3059\u308b<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# docker-compose down\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>docker\u3068docker-compose\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3002 # apt install docker.io docker-compose \u4e0b\u8a18\u306eyml\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u3002 version: &#8216;3&#8217; services: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,7],"tags":[],"class_list":["post-1890","post","type-post","status-publish","format-standard","hentry","category-docker","category-php"],"views":794,"_links":{"self":[{"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/posts\/1890","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1890"}],"version-history":[{"count":2,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/posts\/1890\/revisions"}],"predecessor-version":[{"id":1893,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/posts\/1890\/revisions\/1893"}],"wp:attachment":[{"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1890"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1890"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1890"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}