質問するログイン新規登録

回答編集履歴

2

Fix answer

2020/07/19 03:57

投稿

y_shinoda
y_shinoda

スコア3272

answer CHANGED
@@ -1,14 +1,66 @@
1
- WordPress の公式イメージは英語版なので日本語版のように言語がインストールされていません
2
- 次の記事で解説されている手順何らかの方法で自分で自動化する必要があります:
1
+ 次のように bind マウント変更し:
3
- [日本語リソースのインストール | WordPress.org 日本語](https://ja.wordpress.org/install-ja/)
4
2
 
5
- WordPress の公式イメージではなく、PHP のイメージに `Bedrock` をマウントし、
6
- `composer.json``koodimonni-language` を設定することで
3
+ ```yaml
7
- `composer` を実行することで言語をインストールした方が楽ではないかと思います
4
+ volumes:
8
- [Bedrock | WordPress Boilerplate | Roots](https://roots.io/bedrock/)
5
+ - ./wp-content:/var/www/html/wp-content
9
- [Wordpress language packs Composer Repository](https://wp-languages.github.io/)
6
+ ```
10
7
 
11
- その際は、
12
- PHP の公式イメージは `composer` や必要な PHP モジュール、extension がインストールされていないので
13
- 次のイメージを使った方が便利です
14
- [chialab/php - Docker Hub](https://hub.docker.com/r/chialab/php/)
8
+
9
+
10
+ ```yaml
11
+ volumes:
12
+ - ./wordpress:/var/www/html
13
+ ```
14
+
15
+ 且つ、**ホスト側にディレクトリーを作っていない状態で**
16
+ `docker-compose up` すると、言語選択が表示されます
17
+
18
+ ## 原因
19
+
20
+ WordPress の公式イメージは最初、
21
+ /var/www/html は空になっており、
22
+ `ENTRYPOINT` の処理で
23
+ WordPress のコードがドキュメントルートにデプロイされる仕組みになっています
24
+ 参考: [wordpress/docker-entrypoint.sh at master · docker-library/wordpress](https://github.com/docker-library/wordpress/blob/6e29f5aa794cfa3b5cae30dacab50228b7d659a4/php7.4/apache/docker-entrypoint.sh#L83)
25
+
26
+ ```yaml
27
+ volumes:
28
+ - db_data:/var/lib/mysql
29
+ ```
30
+
31
+ 上記の bind マウントを行うと、`docker-compose up` を行うと、
32
+ デプロイに失敗します:
33
+
34
+ ```console
35
+ $ docker-compose up
36
+ Creating network "test-docker-compose_default" with the default driver
37
+ Creating volume "test-docker-compose_db_data" with default driver
38
+ Creating test-docker-compose_db_1 ... done
39
+ Creating test-docker-compose_wordpress_1 ... done
40
+ Attaching to test-docker-compose_db_1, test-docker-compose_wordpress_1
41
+ db_1 | 2020-07-19 03:33:17+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.29-1debian9 started.
42
+ db_1 | 2020-07-19 03:33:17+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
43
+ db_1 | 2020-07-19 03:33:17+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.29-1debian9 started.
44
+ db_1 | 2020-07-19 03:33:17+00:00 [Note] [Entrypoint]: Initializing database files
45
+ db_1 | 2020-07-19T03:33:17.556858Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
46
+ db_1 | 2020-07-19T03:33:17.844306Z 0 [Warning] InnoDB: New log files created, LSN=45790
47
+ db_1 | 2020-07-19T03:33:17.925250Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
48
+ wordpress_1 | WordPress not found in /var/www/html - copying now...
49
+ wordpress_1 | WARNING: /var/www/html is not empty! (copying anyhow)
50
+ wordpress_1 | tar: ./wp-content/themes/twentyseventeen: Cannot mkdir: No such file or directory
51
+ db_1 | 2020-07-19T03:33:17.961174Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 9613a600-c970-11ea-853e-0242ac1c0002.
52
+ db_1 | 2020-07-19T03:33:17.973753Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
53
+ wordpress_1 | tar: ./wp-content/themes/twentyseventeen: Cannot mkdir: No such file or directory
54
+ wordpress_1 | tar: ./wp-content/themes/twentyseventeen/screenshot.png: Cannot open: No such file or directory
55
+ wordpress_1 | tar: ./wp-content/themes/twentyseventeen: Cannot mkdir: No such file or directory
56
+ wordpress_1 | tar: ./wp-content/themes/twentyseventeen/page.php: Cannot open: No such file or directory
57
+ wordpress_1 | tar: ./wp-content/themes/twentyseventeen: Cannot mkdir: No such file or directory
58
+ wordpress_1 | tar: ./wp-content/themes/twentyseventeen/footer.php: Cannot open: No such file or directory
59
+ wordpress_1 | tar: ./wp-content/themes/twentyseventeen: Cannot mkdir: No such file or directory
60
+ wordpress_1 | tar: ./wp-content/themes/twentyseventeen/rtl.css: Cannot open: No such file or directory
61
+ wordpress_1 | tar: ./wp-content/themes/twentyseventeen: Cannot mkdir: No such file or directory
62
+ wordpress_1 | tar: ./wp-content/themes/twentyseventeen/search.php: Cannot open: No such file or directory
63
+ db_1 | 2020-07-19T03:33:20.264375Z 0 [Warning] CA certificate ca.pem is self signed.
64
+ db_1 | 2020-07-19T03:33:20.932808Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
65
+ wordpress_1 | tar: Exiting with failure status due to previous errors
66
+ ```

1

Add expression

2020/07/19 03:57

投稿

y_shinoda
y_shinoda

スコア3272

answer CHANGED
@@ -3,8 +3,10 @@
3
3
  [日本語リソースのインストール | WordPress.org 日本語](https://ja.wordpress.org/install-ja/)
4
4
 
5
5
  WordPress の公式イメージではなく、PHP のイメージに `Bedrock` をマウントし、
6
+ `composer.json` に `koodimonni-language` を設定することで
6
7
  `composer` を実行することで言語をインストールした方が楽ではないかと思います
7
8
  [Bedrock | WordPress Boilerplate | Roots](https://roots.io/bedrock/)
9
+ [Wordpress language packs Composer Repository](https://wp-languages.github.io/)
8
10
 
9
11
  その際は、
10
12
  PHP の公式イメージは `composer` や必要な PHP モジュール、extension がインストールされていないので