質問編集履歴

1

Dockerfileで検証した内容を追加

2020/05/12 13:41

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -132,81 +132,81 @@
132
132
 
133
133
 
134
134
 
135
- ---> Running in 99cd35a01be3
136
-
137
- Removing intermediate container 99cd35a01be3
138
-
139
- ---> db6ccf021215
140
-
141
- Step 3/9 : RUN apt-get update
142
-
143
- ---> Running in 891ade3e6454
144
-
145
- Err:1 http://security.debian.org/debian-security buster/updates InRelease
146
-
147
- Temporary failure resolving 'security.debian.org'
148
-
149
- Err:2 http://deb.debian.org/debian buster InRelease
150
-
151
- Temporary failure resolving 'deb.debian.org'
152
-
153
- Err:3 http://deb.debian.org/debian buster-updates InRelease
154
-
155
- Temporary failure resolving 'deb.debian.org'
156
-
157
- Reading package lists...
158
-
159
- W: Failed to fetch http://deb.debian.org/debian/dists/buster/InRelease Temporary failure resolving 'deb.debian.org'
160
-
161
- W: Failed to fetch http://security.debian.org/debian-security/dists/buster/updates/InRelease Temporary failure resolving 'security.debian.org'
162
-
163
- W: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/InRelease Temporary failure resolving 'deb.debian.org'
164
-
165
- W: Some index files failed to download. They have been ignored, or old ones used instead.
166
-
167
- Removing intermediate container 891ade3e6454
168
-
169
- ---> ce8c52f90080
170
-
171
- Step 4/9 : RUN apt-get install -y libpq-dev libjpeg-dev libpng-dev vim nodejs sendmail git libzip-dev unzip
172
-
173
- ---> Running in 5e818608a902
174
-
175
- Reading package lists...
176
-
177
- Building dependency tree...
178
-
179
- Reading state information...
180
-
181
- Package git is not available, but is referred to by another package.
182
-
183
- This may mean that the package is missing, has been obsoleted, or
184
-
185
- is only available from another source
186
-
187
-
188
-
189
- E: Unable to locate package libpq-dev
190
-
191
- E: Unable to locate package libjpeg-dev
192
-
193
- E: Unable to locate package libpng-dev
194
-
195
- E: Unable to locate package vim
196
-
197
- E: Unable to locate package nodejs
198
-
199
- E: Unable to locate package sendmail
200
-
201
- E: Package 'git' has no installation candidate
202
-
203
- E: Unable to locate package libzip-dev
204
-
205
- E: Unable to locate package unzip
135
+ ---> Running in 99cd35a01be3
136
+
137
+ Removing intermediate container 99cd35a01be3
138
+
139
+ ---> db6ccf021215
140
+
141
+ Step 3/9 : RUN apt-get update
142
+
143
+ ---> Running in 891ade3e6454
144
+
145
+ Err:1 http://security.debian.org/debian-security buster/updates InRelease
146
+
147
+ Temporary failure resolving 'security.debian.org'
148
+
149
+ Err:2 http://deb.debian.org/debian buster InRelease
150
+
151
+ Temporary failure resolving 'deb.debian.org'
152
+
153
+ Err:3 http://deb.debian.org/debian buster-updates InRelease
154
+
155
+ Temporary failure resolving 'deb.debian.org'
156
+
157
+ Reading package lists...
158
+
159
+ W: Failed to fetch http://deb.debian.org/debian/dists/buster/InRelease Temporary failure resolving 'deb.debian.org'
160
+
161
+ W: Failed to fetch http://security.debian.org/debian-security/dists/buster/updates/InRelease Temporary failure resolving 'security.debian.org'
162
+
163
+ W: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/InRelease Temporary failure resolving 'deb.debian.org'
164
+
165
+ W: Some index files failed to download. They have been ignored, or old ones used instead.
166
+
167
+ Removing intermediate container 891ade3e6454
168
+
169
+ ---> ce8c52f90080
170
+
171
+ Step 4/9 : RUN apt-get install -y libpq-dev libjpeg-dev libpng-dev vim nodejs sendmail git libzip-dev unzip
172
+
173
+ ---> Running in 5e818608a902
174
+
175
+ Reading package lists...
176
+
177
+ Building dependency tree...
178
+
179
+ Reading state information...
180
+
181
+ Package git is not available, but is referred to by another package.
182
+
183
+ This may mean that the package is missing, has been obsoleted, or
184
+
185
+ is only available from another source
186
+
187
+
188
+
189
+ E: Unable to locate package libpq-dev
190
+
191
+ E: Unable to locate package libjpeg-dev
192
+
193
+ E: Unable to locate package libpng-dev
194
+
195
+ E: Unable to locate package vim
196
+
197
+ E: Unable to locate package nodejs
198
+
199
+ E: Unable to locate package sendmail
200
+
201
+ E: Package 'git' has no installation candidate
202
+
203
+ E: Unable to locate package libzip-dev
204
+
205
+ E: Unable to locate package unzip
206
206
 
207
207
  ERROR: Service 'line-app-server' failed to build: The command '/bin/sh -c apt-get install -y libpq-dev libjpeg-dev libpng-dev vim nodejs sendmail git libzip-dev unzip' returned a non-zero code:
208
208
 
209
- 100
209
+ 100
210
210
 
211
211
  ```
212
212
 
@@ -232,9 +232,17 @@
232
232
 
233
233
  ```ini
234
234
 
235
+
236
+
235
- docker container create --name php-server -it --net host -p 8080:80 php:latest /bin/bash
237
+ docker container create --name php-server -it --net host -p 8080:80 php:latest /bin/bash
236
-
238
+
239
+
240
+
237
- ```
241
+ ```
242
+
243
+
244
+
245
+
238
246
 
239
247
  上記の様に、--net hostというパラメータをつけて phpコンテナ単体で実行し
240
248
 
@@ -251,3 +259,83 @@
251
259
 
252
260
 
253
261
  どなたか解決方法がわかる方、ご存知のかたご教授くださると幸いです。
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+ 実行しているDockerfileは以下のとおりです
270
+
271
+
272
+
273
+ ```ini
274
+
275
+
276
+
277
+ FROM php:7.2.19-fpm
278
+
279
+
280
+
281
+ # (1)
282
+
283
+ RUN apt-get update
284
+
285
+ # (2)
286
+
287
+ RUN apt-get install -y libpq-dev libjpeg-dev libpng-dev vim nodejs sendmail git libzip-dev unzip
288
+
289
+ # (3)
290
+
291
+ RUN docker-php-ext-configure gd --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/
292
+
293
+ # (4)
294
+
295
+ RUN docker-php-ext-install gd opcache pdo_pgsql pdo_mysql
296
+
297
+
298
+
299
+
300
+
301
+ # git動作環境で 非SSLでも通信できるように設定
302
+
303
+ RUN git config --global http.sslVerify false
304
+
305
+ # Composerのインストール
306
+
307
+ COPY --from=composer /usr/bin/composer /usr/bin/composer
308
+
309
+
310
+
311
+ WORKDIR /var/www/html
312
+
313
+
314
+
315
+ ```
316
+
317
+
318
+
319
+
320
+
321
+ 検証処理(1)
322
+
323
+ 上記の#(1)~#(4)のRUNコマンドをコメントアウトしてほぼコンテナイメージのままビルドして、dokcer container exec -it コンテナ名 /bin/bash でコンテナ内に入って
324
+
325
+ apt-get update してもエラーで帰ってきました。
326
+
327
+
328
+
329
+ 検証処理(2)
330
+
331
+ ただ、docker-compose.ymlに
332
+
333
+ network_mode: "host"を追加した状態で
334
+
335
+ 同じく
336
+
337
+ 上記の#(1)~#(4)のRUNコマンドをコメントアウトしてほぼコンテナイメージのままビルドして、dokcer container exec -it コンテナ名 /bin/bash でコンテナ内に入って
338
+
339
+ apt-get update した場合はうまく updateがはしりました。
340
+
341
+ ただDockerfileにRUN apt-get updateを記述した場合は、同様にDNS関連のエラーのような ものが発生します。