{"id":653,"date":"2019-05-05T10:22:38","date_gmt":"2019-05-05T01:22:38","guid":{"rendered":"https:\/\/dennie.tokyo\/it\/?p=653"},"modified":"2022-03-29T11:57:17","modified_gmt":"2022-03-29T02:57:17","slug":"docker-compose%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%9flamp%e7%92%b0%e5%a2%83%e3%81%ae%e6%a7%8b%e7%af%89","status":"publish","type":"post","link":"https:\/\/dennie.tokyo\/it\/?p=653","title":{"rendered":"\u3010docker\u3011docker compose\u3092\u4f7f\u7528\u3057\u305fLAMP\u74b0\u5883\u306e\u69cb\u7bc9"},"content":{"rendered":"\n<p>docker compose\u3092\u4f7f\u7528\u3057\u3066LAMP\u74b0\u5883\u306e\u69cb\u7bc9\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>\u30dd\u30a4\u30f3\u30c8\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"title_box\"><span class=\"box-title\">\u30dd\u30a4\u30f3\u30c8<\/span>\n<p>web\u30b5\u30fc\u30d0\u30b3\u30f3\u30c6\u30ca\u3068mysql\u30b3\u30f3\u30c6\u30ca\u3092\u751f\u6210\u3059\u308b\u3002<\/p>\n<p>2\u3064\u306e\u30b3\u30f3\u30c6\u30ca\u3092\u540c\u3058\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3078\u53c2\u52a0\u3055\u305b\u308b\u3002<\/p>\n<p>web\u30b5\u30fc\u30d0\u30b3\u30f3\u30c6\u30ca\u306f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30eb\u30fc\u30c8\u3068\u30ed\u30fc\u30ab\u30eb\u7aef\u672b\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u5171\u6709\u3055\u305b\u308b\u3002<\/p>\n<p>mysql\u30b3\u30f3\u30c6\u30ca\u306f\u3001\u30c7\u30fc\u30bf\u3092\u30ed\u30fc\u30ab\u30eb\u7aef\u672b\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u5171\u6709\u3055\u305b\u308b\u3002<\/p>\n<\/div>\n\n\n\n<h1 class=\"wp-block-heading\">\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210<\/h1>\n\n\n\n<p>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210\u306f\u4ee5\u4e0b\u3068\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><thead><tr><th scope=\"col\">\u30c7\u30a3\u30ec\u30af\u30c8\u30ea or \u30d5\u30a1\u30a4\u30eb<\/th><th scope=\"col\">\u8aac\u660e<\/th><\/tr><tr><td>app<\/td><td>html\u3084php\u30d5\u30a1\u30a4\u30eb\u306a\u3069\u3092\u914d\u7f6e\u3059\u308b\u70ba\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea<\/td><\/tr><\/thead><tbody><tr><td>docker-compose.yml<\/td><td>docker-compose.yml\u30d5\u30a1\u30a4\u30eb<\/td><\/tr><tr><td>docker\/web\/Dockerfile<\/td><td>Dockerfile\u30d5\u30a1\u30a4\u30eb<\/td><\/tr><tr><td>docker\/db\/volume<\/td><td>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u683c\u7d0d\u9818\u57df<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">\u5b9a\u7fa9\u30d5\u30a1\u30a4\u30eb\u306e\u5185\u5bb9<\/h1>\n\n\n\n<p>\u5b9a\u7fa9\u30d5\u30a1\u30a4\u30eb(docker-compose.yml)\u306e\u5185\u5bb9\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<br>\u4ee5\u964d\u306f\u5b9a\u7fa9\u30d5\u30a1\u30a4\u30eb\u306e\u8a18\u8f09\u5185\u5bb9\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>version: &#39;3&#39;\nservices:\n\n  web:\n    container_name: Laravel5.8\n    restart: always\n    build:\n      context: .\n      dockerfile: .\/docker\/web\/Dockerfile\n    privileged: true\n    ports:\n      - 4003:80\n    volumes:\n      - .\/app:\/www-contents\n\n  db:\n    container_name: Laravel_mysql_5.7\n    restart: always\n    image: mysql:5.7\n    ports:\n      - 3307:3306\n    volumes:\n      - .\/docker\/db\/volume:\/var\/lib\/mysql\n    environment:\n      - MYSQL_ALLOW_EMPTY_PASSWORD=yes\n      - MYSQL_ROOT_PASSWORD=root\n      - MYSQL_DATABASE=sample\n      - MYSQL_USER=user\n      - MYSQL_PASSWORD=password<\/code><\/pre><\/div>\n\n\n\n<h1 class=\"wp-block-heading\">web\u30b5\u30fc\u30d0\u30b3\u30f3\u30c6\u30ca<\/h1>\n\n\n\n<p>docker-compose.yml\u3067&#8221;web&#8221;\u3068\u66f8\u304b\u308c\u305f\u90e8\u5206\u306f\u3001web\u30b5\u30fc\u30d0\u306e\u30a4\u30e1\u30fc\u30b8\u3092\u751f\u6210\u3059\u308b\u5185\u5bb9\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">docker\u30d5\u30a1\u30a4\u30eb\u306e\u30d3\u30eb\u30c9<\/h2>\n\n\n\n<p>\u6307\u5b9a\u3057\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u3042\u308bdocker\u30d5\u30a1\u30a4\u30eb\u3092\u30d3\u30eb\u30c9\u3057\u307e\u3059\u3002<br>docker\u30d5\u30a1\u30a4\u30eb\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u306f &#8220;Dockerfile&#8221; \u3068\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>    build:\n      context: .\n      dockerfile: .\/docker\/web\/Dockerfile<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">\u30b3\u30f3\u30c6\u30ca\u540d<\/h2>\n\n\n\n<p>docker \u30b3\u30f3\u30c6\u30ca\u540d\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u4eca\u56de\u306f Laravel5.8 \u3068\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>container_name: Laravel5.8<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">\u30dd\u30fc\u30c8\u306e\u958b\u653e<\/h2>\n\n\n\n<p>\u30dd\u30fc\u30c8\u3092\u89e3\u653e\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>ports:\n      - 4003:80<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5171\u6709<\/h2>\n\n\n\n<p>\u30db\u30b9\u30c8OS\u3068\u30b2\u30b9\u30c8OS\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u5171\u6709\u3057\u307e\u3059\u3002\u4eca\u56de\u306f\u30db\u30b9\u30c8\u5074\u306e app \u3068\u3044\u3046\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3068\u30b2\u30b9\u30c8OS\u306fApache\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30eb\u30fc\u30c8\u3092\u5171\u6709\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>volumes:\n      - .\/app:\/www-contents<\/code><\/pre><\/div>\n\n\n\n<h1 class=\"wp-block-heading\">mysql\u30b5\u30fc\u30d0\u30b3\u30f3\u30c6\u30ca<\/h1>\n\n\n\n<p>docker-compose.yml\u3067&#8221;db&#8221;\u3068\u66f8\u304b\u308c\u305f\u90e8\u5206\u306f\u3001mysql\u30a4\u30e1\u30fc\u30b8\u3092\u751f\u6210\u3059\u308b\u5185\u5bb9\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5229\u7528\u3059\u308b\u30a4\u30e1\u30fc\u30b8<\/h2>\n\n\n\n<p>Web\u30b5\u30fc\u30d0\u306e\u30a4\u30e1\u30fc\u30b8\u3092\u751f\u6210\u3059\u308b\u5834\u5408\u3001docker\u30d5\u30a1\u30a4\u30eb\u3092\u5229\u7528\u3057\u307e\u3057\u305f\u3002<br>mysql\u30b3\u30f3\u30c6\u30ca\u306e\u751f\u6210\u306b\u306f\u3001docker\u30d5\u30a1\u30a4\u30eb\u3092\u5229\u7528\u3057\u305f\u30a4\u30e1\u30fc\u30b8\u3092\u4f7f\u7528\u305b\u305a\u3001docker hub\u306b\u5b58\u5728\u3059\u308bmysql\u30a4\u30e1\u30fc\u30b8\u3092\u6307\u5b9a\u3057\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>image: mysql:5.7<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">\u74b0\u5883\u8a2d\u5b9a<\/h2>\n\n\n\n<p>mysql\u30b3\u30f3\u30c6\u30ca\u3092\u751f\u6210\u3059\u308b\u969b\u306b\u5fc5\u8981\u306a\u74b0\u5883\u8a2d\u5b9a\u5024\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>    environment:\n      - MYSQL_ALLOW_EMPTY_PASSWORD=yes\n      - MYSQL_ROOT_PASSWORD=root\n      - MYSQL_DATABASE=sample\n      - MYSQL_USER=user\n      - MYSQL_PASSWORD=password<\/code><\/pre><\/div>\n\n\n\n<h1 class=\"wp-block-heading\">\u30cd\u30c3\u30c8\u30ef\u30fc\u30af<\/h1>\n\n\n\n<p>docker\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306f\u3001docker compose\u3092\u5b9f\u884c\u3059\u308b\u3068\u81ea\u52d5\u3067\u751f\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">\u6700\u5f8c\u306b<\/h1>\n\n\n\n<p>docker compose\u306e\u5b9f\u884c\u306f\u3001\u4ee5\u4e0b\u3092\u53c2\u7167\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n\n\n\n<div class=\"title_box\"><span class=\"box-title\">\u53c2\u8003<\/span><p><a href=\"https:\/\/dennie.tokyo\/it\/?p=671\" target=\"_blank\" rel=\"noopener\">\u3010docker\u3011docker compose\u30b3\u30de\u30f3\u30c9<\/a>\n<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>docker compose\u3092\u4f7f\u7528\u3057\u3066LAMP\u74b0\u5883\u306e\u69cb\u7bc9\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":968,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-653","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-docker"],"_links":{"self":[{"href":"https:\/\/dennie.tokyo\/it\/index.php?rest_route=\/wp\/v2\/posts\/653","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dennie.tokyo\/it\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dennie.tokyo\/it\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dennie.tokyo\/it\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dennie.tokyo\/it\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=653"}],"version-history":[{"count":23,"href":"https:\/\/dennie.tokyo\/it\/index.php?rest_route=\/wp\/v2\/posts\/653\/revisions"}],"predecessor-version":[{"id":3196,"href":"https:\/\/dennie.tokyo\/it\/index.php?rest_route=\/wp\/v2\/posts\/653\/revisions\/3196"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dennie.tokyo\/it\/index.php?rest_route=\/wp\/v2\/media\/968"}],"wp:attachment":[{"href":"https:\/\/dennie.tokyo\/it\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=653"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dennie.tokyo\/it\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=653"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dennie.tokyo\/it\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=653"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}