{"id":7340,"date":"2022-12-29T16:46:21","date_gmt":"2022-12-29T07:46:21","guid":{"rendered":"https:\/\/lab4ict.com\/system\/?p=7340"},"modified":"2023-03-02T07:06:42","modified_gmt":"2023-03-01T22:06:42","slug":"docker-compose%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%a6wordpress%e3%81%ae%e3%81%8a%e8%a9%a6%e3%81%97%e7%92%b0%e5%a2%83%e3%82%92%e6%a7%8b%e7%af%89%e3%81%99%e3%82%8b%ef%bc%81","status":"publish","type":"post","link":"https:\/\/lab4ict.com\/system\/archives\/7340","title":{"rendered":"Docker Compose\u3092\u4f7f\u7528\u3057\u3066WordPress\u306e\u304a\u8a66\u3057\u74b0\u5883\u3092\u69cb\u7bc9\u3059\u308b\uff01"},"content":{"rendered":"<p>Docker Compose\u3092\u4f7f\u7528\u3057\u3066WordPress\u306e\u304a\u8a66\u3057\u74b0\u5883\u3092\u69cb\u7bc9\u3057\u307e\u3059\u3002<br \/>\n<!--more--><\/p>\n<h2>Docker Compose\u306eWordPress\u74b0\u5883\u69cb\u7bc9\u306e\u30da\u30fc\u30b8\u3092\u78ba\u8a8d\u3059\u308b\uff01<\/h2>\n<p>Docker Compose\u306eWordPress\u74b0\u5883\u69cb\u7bc9\u306e\u30da\u30fc\u30b8\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002Docker Compose\u306e\u30b5\u30f3\u30d7\u30eb\u306eYML\u306e\u8a18\u8f09\u304c\u3042\u308b\u306e\u3067\u3001\u305d\u306e\u307e\u307e\u306e\u5185\u5bb9\u3092\u8a66\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/docker\/awesome-compose\/tree\/master\/official-documentation-samples\/wordpress\/\" target=\"_blank\" rel=\"noopener\">Quickstart: Compose and WordPress<\/a><\/li>\n<\/ul>\n<h2>WordPress\u7528\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3059\u308b\uff01<\/h2>\n<p>WordPress\u7528\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ mkdir wordpress\r\n$ cd wordpress\r\n<\/pre>\n<h2>Docker Compose\u7528\u306eYML\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\uff01<\/h2>\n<p>\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u306b\u8a18\u8f09\u901a\u308a\u306bYML\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ cat docker-compose.yml \r\nservices:\r\n  db:\r\n    # We use a mariadb image which supports both amd64 &amp; arm64 architecture\r\n    image: mariadb:10.6.4-focal\r\n    # If you really want to use MySQL, uncomment the following line\r\n    #image: mysql:8.0.27\r\n    command: '--default-authentication-plugin=mysql_native_password'\r\n    volumes:\r\n      - db_data:\/var\/lib\/mysql\r\n    restart: always\r\n    environment:\r\n      - MYSQL_ROOT_PASSWORD=somewordpress\r\n      - MYSQL_DATABASE=wordpress\r\n      - MYSQL_USER=wordpress\r\n      - MYSQL_PASSWORD=wordpress\r\n    expose:\r\n      - 3306\r\n      - 33060\r\n  wordpress:\r\n    image: wordpress:latest\r\n    volumes:\r\n      - wp_data:\/var\/www\/html\r\n    ports:\r\n      - 80:80\r\n    restart: always\r\n    environment:\r\n      - WORDPRESS_DB_HOST=db\r\n      - WORDPRESS_DB_USER=wordpress\r\n      - WORDPRESS_DB_PASSWORD=wordpress\r\n      - WORDPRESS_DB_NAME=wordpress\r\nvolumes:\r\n  db_data:\r\n  wp_data:\r\n<\/pre>\n<h2>Docker Compose\u3092\u5b9f\u884c\u3059\u308b\uff01<\/h2>\n<p>\u300cdocker compose up -d\u300d\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ docker compose up -d\r\n&#x5B;+] Running 33\/33\r\n \u283f wordpress Pulled                                                                                              110.1s\r\n   \u283f 3f4ca61aafcd Pull complete                                                                                   19.0s\r\n   \u283f 460703cf6140 Pull complete                                                                                   19.0s\r\n   \u283f eba06349db87 Pull complete                                                                                   35.8s\r\n   \u283f 9130a4183abd Pull complete                                                                                   46.7s\r\n   \u283f fd60536a0833 Pull complete                                                                                   60.8s\r\n   \u283f 52e54498bf19 Pull complete                                                                                   64.9s\r\n   \u283f 9812d18c874f Pull complete                                                                                   65.1s\r\n   \u283f c8e7bd813a15 Pull complete                                                                                   65.2s\r\n   \u283f 8ed3738d1e82 Pull complete                                                                                   65.4s\r\n   \u283f d429891cf708 Pull complete                                                                                   75.1s\r\n   \u283f 4491b8a38be3 Pull complete                                                                                   80.5s\r\n   \u283f 4526c9d9f280 Pull complete                                                                                   93.3s\r\n   \u283f 4424c6f227a5 Pull complete                                                                                   96.6s\r\n   \u283f a8a1f369525d Pull complete                                                                                  104.0s\r\n   \u283f ad24f4329216 Pull complete                                                                                  104.7s\r\n   \u283f dd26bd91526d Pull complete                                                                                  104.8s\r\n   \u283f 29019a67605d Pull complete                                                                                  104.9s\r\n   \u283f 4ce95bfc3e92 Pull complete                                                                                  105.0s\r\n   \u283f 562b965c40f6 Pull complete                                                                                  106.1s\r\n   \u283f 8dead0bbb639 Pull complete                                                                                  106.2s\r\n   \u283f d91028db2d05 Pull complete                                                                                  106.3s\r\n \u283f db Pulled                                                                                                      21.3s\r\n   \u283f 7b1a6ab2e44d Pull complete                                                                                    3.9s\r\n   \u283f 034655750c88 Pull complete                                                                                    4.0s\r\n   \u283f f0b757a2a0f0 Pull complete                                                                                    4.3s\r\n   \u283f 5c37daf8b6b5 Pull complete                                                                                    4.5s\r\n   \u283f b4cd9409b0f6 Pull complete                                                                                    4.6s\r\n   \u283f dbcda06785eb Pull complete                                                                                    5.7s\r\n   \u283f a34cd90f184c Pull complete                                                                                    5.8s\r\n   \u283f fd6cef4ce489 Pull complete                                                                                    5.9s\r\n   \u283f 3cb89a1550ea Pull complete                                                                                   17.2s\r\n   \u283f df9f153bd930 Pull complete                                                                                   17.4s\r\n&#x5B;+] Running 5\/5\r\n \u283f Network wordpress_default        Created                                                                        0.5s\r\n \u283f Volume &quot;wordpress_db_data&quot;       Created                                                                        0.0s\r\n \u283f Volume &quot;wordpress_wp_data&quot;       Created                                                                        0.0s\r\n \u283f Container wordpress-db-1         Started                                                                        1.8s\r\n \u283f Container wordpress-wordpress-1  Started                                                                        1.8s\r\n<\/pre>\n<h2>WordPress\u306e\u30da\u30fc\u30b8\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\uff01<\/h2>\n<p>Docker Compose\u3092\u5b9f\u884c\u3057\u305f\u30de\u30b7\u30f3\u4e0a\u3067\u3001\u4ee5\u4e0b\u306eURL\u3067WordPress\u306e\u30c8\u30c3\u30d7\u30da\u30fc\u30b8\u306b\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002WordPress\u306e\u521d\u671f\u8a2d\u5b9a\u306e\u30da\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nhttp:\/\/localhost\r\n<\/pre>\n<p><a href=\"https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2022\/12\/docker-compose_workdpress_01.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2022\/12\/docker-compose_workdpress_01.png\" alt=\"\" width=\"1332\" height=\"1024\" class=\"alignnone size-full wp-image-7347\" srcset=\"https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2022\/12\/docker-compose_workdpress_01.png 1332w, https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2022\/12\/docker-compose_workdpress_01-300x231.png 300w, https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2022\/12\/docker-compose_workdpress_01-1024x787.png 1024w, https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2022\/12\/docker-compose_workdpress_01-768x590.png 768w\" sizes=\"auto, (max-width: 1332px) 100vw, 1332px\" \/><\/a><\/p>\n<p>\u5916\u90e8\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u304b\u3089\u3082\u30a2\u30af\u30bb\u30b9\u53ef\u80fd\u306a\u306e\u3067\u3001\u30b5\u30fc\u30d0\u540d\u304c\u300cserver01\u300d\u3067\u540d\u524d\u89e3\u6c7a\u304c\u53ef\u80fd\u306a\u5834\u5408\u3001\u4ed6\u306e\u30de\u30b7\u30f3\u304b\u3089\u4ee5\u4e0b\u306eURL\u3067\u3082\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nhttp:\/\/server01\r\n<\/pre>\n<h2>\u69cb\u7bc9\u3057\u305f\u74b0\u5883\u3092\u524a\u9664\u3059\u308b\uff01<\/h2>\n<p>\u304a\u8a66\u3057\u74b0\u5883\u306a\u306e\u3067\u3001\u4f7f\u7528\u304c\u7d42\u308f\u3063\u305f\u3089\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3068DB\u3092\u542b\u3081\u3066\u5b8c\u5168\u306b\u524a\u9664\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ docker compose down --volumes\r\n&#x5B;+] Running 5\/5\r\n \u283f Container wordpress-wordpress-1  Removed                                                                        1.8s\r\n \u283f Container wordpress-db-1         Removed                                                                        1.3s\r\n \u283f Volume wordpress_wp_data         Removed                                                                        0.3s\r\n \u283f Volume wordpress_db_data         Removed                                                                        0.0s\r\n \u283f Network wordpress_default        Removed  \r\n<\/pre>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3001DB\u3060\u3051\u6b8b\u3059\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ docker compose down\r\n<\/pre>\n<h2>\u304a\u308f\u308a\u306b<\/h2>\n<p>Docker Compose\u3067WordPress\u306e\u74b0\u5883\u69cb\u7bc9\u3059\u308b\u305f\u3081\u306eYML\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u3001\u300cdocker compose\u300d\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3060\u3051\u3067\u3001\u3042\u3063\u3068\u3044\u3046\u9593\u306bWordPress\u306e\u304a\u8a66\u3057\u74b0\u5883\u304c\u69cb\u7bc9\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>\u53c2\u8003\u60c5\u5831<\/h2>\n<ul>\n<li><a href=\"https:\/\/docs.docker.com\/\" target=\"_blank\" rel=\"noopener\">Docker Docs<\/a><\/li>\n<li><a href=\"https:\/\/hub.docker.com\/\" target=\"_blank\" rel=\"noopener\">Docker Hub<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/docker\" target=\"_blank\" rel=\"noopener\">GitHub - Docker<\/a><\/li>\n<\/ul>\n<h2>\u95a2\u9023\u8a18\u4e8b<\/h2>\n<div class=\"sc_getpost\"><a class=\"clearfix\" href=\"https:\/\/lab4ict.com\/system\/archives\/6869\" ><div class=\"sc_getpost_thumb post-box-thumbnail__wrap\"><img decoding=\"async\" src=\"data:image\/gif;base64,R0lGODdhAQABAPAAAN3d3QAAACwAAAAAAQABAAACAkQBADs=\" width=\"150\" height=\"150\" alt=\"\u3010\u8a18\u4e8b\u4e00\u89a7\u3011Docker\u3067\u30b3\u30f3\u30c6\u30ca\u3092\u4f7f\u3044\u3053\u306a\u3059\uff01\" loading=\"lazy\" data-src=\"https:\/\/lab4ict.com\/system\/wp-content\/uploads\/2020\/01\/eyecatch_docker_01-150x150.png\" class=\"lazyload\"><\/div><div class=\"title\">\u3010\u8a18\u4e8b\u4e00\u89a7\u3011Docker\u3067\u30b3\u30f3\u30c6\u30ca\u3092\u4f7f\u3044\u3053\u306a\u3059\uff01<\/div><div class=\"substr\">Docker\u3067\u30b3\u30f3\u30c6\u30ca\u3092\u4f7f\u3044\u3053\u306a\u3059\u305f\u3081\u306e\u8a18\u4e8b\u4e00\u89a7\u3092\u63b2\u8f09\u3057\u307e\u3059\u3002...<\/div><\/a><\/div>\n<h2>\u95a2\u9023\u66f8\u7c4d\uff08Amazon\uff09<\/h2>\n<p><iframe sandbox=\"allow-popups allow-scripts allow-modals allow-forms allow-same-origin\" style=\"width:120px;height:240px;\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" frameborder=\"0\" src=\"\/\/rcm-fe.amazon-adsystem.com\/e\/cm?lt1=_blank&bc1=000000&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=infotecr-22&language=ja_JP&o=9&p=8&l=as4&m=amazon&f=ifr&ref=as_ss_li_til&asins=B0998CHJ9W&linkId=19a3b3108d3e43a0fba5a585ea9cf335\"><\/iframe><\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Docker Compose\u3092\u4f7f\u7528\u3057\u3066WordPress\u306e\u304a\u8a66\u3057\u74b0\u5883\u3092\u69cb\u7bc9\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":6879,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[159],"tags":[],"class_list":["post-7340","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-docker"],"_links":{"self":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/7340","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/comments?post=7340"}],"version-history":[{"count":0,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/posts\/7340\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/media\/6879"}],"wp:attachment":[{"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/media?parent=7340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/categories?post=7340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab4ict.com\/system\/wp-json\/wp\/v2\/tags?post=7340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}