回答編集履歴

2

Fix answer

2020/07/19 03:57

投稿

y_shinoda
y_shinoda

スコア3272

test CHANGED
@@ -1,27 +1,131 @@
1
- WordPress の公式イメージは英語版なので日本語版のように言語がインストールされていません
2
-
3
- 次の記事で解説されている手順何らかの方法で自分で自動化する必要があります:
1
+ 次のように bind マウント変更し:
4
-
5
- [日本語リソースのインストール | WordPress.org 日本語](https://ja.wordpress.org/install-ja/)
6
2
 
7
3
 
8
4
 
9
- WordPress の公式イメージではなく、PHP のイメージに `Bedrock` をマウントし、
5
+ ```yaml
10
6
 
11
- `composer.json` `koodimonni-language` を設定することで
7
+ volumes:
12
8
 
13
- `composer` を実行することで言語をインストールした方が楽ではないかと思います
9
+ - ./wp-content:/var/www/html/wp-content
14
10
 
15
- [Bedrock | WordPress Boilerplate | Roots](https://roots.io/bedrock/)
11
+ ```
16
-
17
- [Wordpress language packs Composer Repository](https://wp-languages.github.io/)
18
12
 
19
13
 
20
14
 
21
- その際は、
15
+
22
16
 
23
- PHP の公式イメージは `composer` や必要な PHP モジュール、extension がインストールされていないので
24
17
 
25
- 次のイメージを使った方が便利です
26
18
 
27
- [chialab/php - Docker Hub](https://hub.docker.com/r/chialab/php/)
19
+ ```yaml
20
+
21
+ volumes:
22
+
23
+ - ./wordpress:/var/www/html
24
+
25
+ ```
26
+
27
+
28
+
29
+ 且つ、**ホスト側にディレクトリーを作っていない状態で**
30
+
31
+ `docker-compose up` すると、言語選択が表示されます
32
+
33
+
34
+
35
+ ## 原因
36
+
37
+
38
+
39
+ WordPress の公式イメージは最初、
40
+
41
+ /var/www/html は空になっており、
42
+
43
+ `ENTRYPOINT` の処理で
44
+
45
+ WordPress のコードがドキュメントルートにデプロイされる仕組みになっています
46
+
47
+ 参考: [wordpress/docker-entrypoint.sh at master · docker-library/wordpress](https://github.com/docker-library/wordpress/blob/6e29f5aa794cfa3b5cae30dacab50228b7d659a4/php7.4/apache/docker-entrypoint.sh#L83)
48
+
49
+
50
+
51
+ ```yaml
52
+
53
+ volumes:
54
+
55
+ - db_data:/var/lib/mysql
56
+
57
+ ```
58
+
59
+
60
+
61
+ 上記の bind マウントを行うと、`docker-compose up` を行うと、
62
+
63
+ デプロイに失敗します:
64
+
65
+
66
+
67
+ ```console
68
+
69
+ $ docker-compose up
70
+
71
+ Creating network "test-docker-compose_default" with the default driver
72
+
73
+ Creating volume "test-docker-compose_db_data" with default driver
74
+
75
+ Creating test-docker-compose_db_1 ... done
76
+
77
+ Creating test-docker-compose_wordpress_1 ... done
78
+
79
+ Attaching to test-docker-compose_db_1, test-docker-compose_wordpress_1
80
+
81
+ db_1 | 2020-07-19 03:33:17+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.29-1debian9 started.
82
+
83
+ db_1 | 2020-07-19 03:33:17+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
84
+
85
+ db_1 | 2020-07-19 03:33:17+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.29-1debian9 started.
86
+
87
+ db_1 | 2020-07-19 03:33:17+00:00 [Note] [Entrypoint]: Initializing database files
88
+
89
+ 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).
90
+
91
+ db_1 | 2020-07-19T03:33:17.844306Z 0 [Warning] InnoDB: New log files created, LSN=45790
92
+
93
+ db_1 | 2020-07-19T03:33:17.925250Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
94
+
95
+ wordpress_1 | WordPress not found in /var/www/html - copying now...
96
+
97
+ wordpress_1 | WARNING: /var/www/html is not empty! (copying anyhow)
98
+
99
+ wordpress_1 | tar: ./wp-content/themes/twentyseventeen: Cannot mkdir: No such file or directory
100
+
101
+ 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.
102
+
103
+ 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.
104
+
105
+ wordpress_1 | tar: ./wp-content/themes/twentyseventeen: Cannot mkdir: No such file or directory
106
+
107
+ wordpress_1 | tar: ./wp-content/themes/twentyseventeen/screenshot.png: Cannot open: No such file or directory
108
+
109
+ wordpress_1 | tar: ./wp-content/themes/twentyseventeen: Cannot mkdir: No such file or directory
110
+
111
+ wordpress_1 | tar: ./wp-content/themes/twentyseventeen/page.php: Cannot open: No such file or directory
112
+
113
+ wordpress_1 | tar: ./wp-content/themes/twentyseventeen: Cannot mkdir: No such file or directory
114
+
115
+ wordpress_1 | tar: ./wp-content/themes/twentyseventeen/footer.php: Cannot open: No such file or directory
116
+
117
+ wordpress_1 | tar: ./wp-content/themes/twentyseventeen: Cannot mkdir: No such file or directory
118
+
119
+ wordpress_1 | tar: ./wp-content/themes/twentyseventeen/rtl.css: Cannot open: No such file or directory
120
+
121
+ wordpress_1 | tar: ./wp-content/themes/twentyseventeen: Cannot mkdir: No such file or directory
122
+
123
+ wordpress_1 | tar: ./wp-content/themes/twentyseventeen/search.php: Cannot open: No such file or directory
124
+
125
+ db_1 | 2020-07-19T03:33:20.264375Z 0 [Warning] CA certificate ca.pem is self signed.
126
+
127
+ 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.
128
+
129
+ wordpress_1 | tar: Exiting with failure status due to previous errors
130
+
131
+ ```

1

Add expression

2020/07/19 03:57

投稿

y_shinoda
y_shinoda

スコア3272

test CHANGED
@@ -8,9 +8,13 @@
8
8
 
9
9
  WordPress の公式イメージではなく、PHP のイメージに `Bedrock` をマウントし、
10
10
 
11
+ `composer.json` に `koodimonni-language` を設定することで
12
+
11
13
  `composer` を実行することで言語をインストールした方が楽ではないかと思います
12
14
 
13
15
  [Bedrock | WordPress Boilerplate | Roots](https://roots.io/bedrock/)
16
+
17
+ [Wordpress language packs Composer Repository](https://wp-languages.github.io/)
14
18
 
15
19
 
16
20