質問編集履歴
2
書き方を修正しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
### 起こった問題のソース
|
10
10
|
|
11
|
-
```
|
11
|
+
```Dockerfile
|
12
12
|
|
13
13
|
RUN apk add --update nodejs npm; \
|
14
14
|
npm install -g browserify; \
|
@@ -18,7 +18,7 @@
|
|
18
18
|
```
|
19
19
|
↑こちらのソースではDokcerコンテナが立ち上がらなかった。
|
20
20
|
以下のように修正したらコンテナが立ち上がってきた。
|
21
|
-
```
|
21
|
+
```Dockerfile
|
22
22
|
|
23
23
|
RUN apk add --update nodejs npm; \
|
24
24
|
apk update; \
|
@@ -60,7 +60,7 @@
|
|
60
60
|
|
61
61
|
```
|
62
62
|
|
63
|
-
```
|
63
|
+
```yml
|
64
64
|
|
65
65
|
version: '3.7'
|
66
66
|
services:
|
@@ -75,7 +75,7 @@
|
|
75
75
|
|
76
76
|
```
|
77
77
|
|
78
|
-
```
|
78
|
+
```shell
|
79
79
|
|
80
80
|
$ docker-compose build --no-cache
|
81
81
|
Building webserver
|
@@ -150,7 +150,7 @@
|
|
150
150
|
|
151
151
|
```
|
152
152
|
|
153
|
-
```
|
153
|
+
```shell
|
154
154
|
|
155
155
|
$docker-compose up -d --build
|
156
156
|
Creating network "react_default" with the default driver
|
@@ -176,7 +176,7 @@
|
|
176
176
|
|
177
177
|
```
|
178
178
|
|
179
|
-
```
|
179
|
+
```shell
|
180
180
|
|
181
181
|
$docker exec -it nginx /bin/sh
|
182
182
|
/app # browserify --version
|
1
環境、テストしたことを追記しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
npm installがうまくいかなかった。
|
4
4
|
これを受けてapk updateコマンドの詳細情報を検索してみたが見つけられなかった。
|
5
5
|
|
6
|
+
### 環境
|
7
|
+
docker-machine上にて環境を構築しています。
|
8
|
+
|
6
9
|
### 起こった問題のソース
|
7
10
|
|
8
11
|
```NG-Dockerfile
|
@@ -36,4 +39,149 @@
|
|
36
39
|
もっとスマートに書きたいのですが
|
37
40
|
有効情報にたどり着けていない状況です。
|
38
41
|
ヒントだけでもいただけましたら嬉しく思います。
|
39
|
-
よろしくお願いいたします。
|
42
|
+
よろしくお願いいたします。
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
### テスト2回目結果
|
48
|
+
|
49
|
+
```Dockerfile
|
50
|
+
|
51
|
+
FROM nginx:mainline-alpine
|
52
|
+
RUN apk update; \
|
53
|
+
apk add nodejs npm; \
|
54
|
+
npm install -g browserify; \
|
55
|
+
npm install -g babel-cli; \
|
56
|
+
apk add git;
|
57
|
+
WORKDIR /app
|
58
|
+
EXPOSE 8080
|
59
|
+
CMD nginx -g "daemon off;"
|
60
|
+
|
61
|
+
```
|
62
|
+
|
63
|
+
```docker-compose.yml
|
64
|
+
|
65
|
+
version: '3.7'
|
66
|
+
services:
|
67
|
+
webserver:
|
68
|
+
build: ./
|
69
|
+
container_name: nginx
|
70
|
+
tty: true
|
71
|
+
volumes:
|
72
|
+
- ./app:/app
|
73
|
+
ports:
|
74
|
+
- "8080:80"
|
75
|
+
|
76
|
+
```
|
77
|
+
|
78
|
+
```build.sh
|
79
|
+
|
80
|
+
$ docker-compose build --no-cache
|
81
|
+
Building webserver
|
82
|
+
Step 1/5 : FROM nginx:mainline-alpine
|
83
|
+
mainline-alpine: Pulling from library/nginx
|
84
|
+
9d48c3bd43c5: Pull complete
|
85
|
+
b6dac14ba0a9: Pull complete
|
86
|
+
Status: Downloaded newer image for nginx:mainline-alpine
|
87
|
+
Step 2/5 : RUN apk update; apk add nodejs npm; npm install -g browserify; npm install -g babel-cli; apk add git;
|
88
|
+
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
|
89
|
+
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
|
90
|
+
v3.10.2-19 [http://dl-cdn.alpinelinux.org/alpine/v3.10/main]
|
91
|
+
v3.10.2-2 [http://dl-cdn.alpinelinux.org/alpine/v3.10/community]
|
92
|
+
OK: 10339 distinct packages available
|
93
|
+
(1/8) Installing ca-certificates (20190108-r0)
|
94
|
+
(2/8) Installing c-ares (1.15.0-r0)
|
95
|
+
(3/8) Installing libgcc (8.3.0-r0)
|
96
|
+
(4/8) Installing http-parser (2.9.2-r0)
|
97
|
+
(5/8) Installing libstdc++ (8.3.0-r0)
|
98
|
+
(6/8) Installing libuv (1.29.1-r0)
|
99
|
+
(7/8) Installing nodejs (10.16.3-r0)
|
100
|
+
(8/8) Installing npm (10.16.3-r0)
|
101
|
+
Executing busybox-1.30.1-r2.trigger
|
102
|
+
Executing ca-certificates-20190108-r0.trigger
|
103
|
+
OK: 82 MiB in 45 packages
|
104
|
+
npm ERR! code ENOTFOUND
|
105
|
+
npm ERR! errno ENOTFOUND
|
106
|
+
npm ERR! network request to https://registry.npmjs.org/cached-path-relative failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
|
107
|
+
npm ERR! network This is a problem related to network connectivity.
|
108
|
+
npm ERR! network In most cases you are behind a proxy or have bad network settings.
|
109
|
+
npm ERR! network
|
110
|
+
npm ERR! network If you are behind a proxy, please make sure that the
|
111
|
+
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
|
112
|
+
|
113
|
+
npm ERR! A complete log of this run can be found in:
|
114
|
+
npm ERR! /root/.npm/_logs/2019-08-28T12_45_46_775Z-debug.log
|
115
|
+
npm ERR! code ENOTFOUND
|
116
|
+
npm ERR! errno ENOTFOUND
|
117
|
+
npm ERR! network request to https://registry.npmjs.org/fs-readdir-recursive failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
|
118
|
+
npm ERR! network This is a problem related to network connectivity.
|
119
|
+
npm ERR! network In most cases you are behind a proxy or have bad network settings.
|
120
|
+
npm ERR! network
|
121
|
+
npm ERR! network If you are behind a proxy, please make sure that the
|
122
|
+
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
|
123
|
+
|
124
|
+
npm ERR! A complete log of this run can be found in:
|
125
|
+
npm ERR! /root/.npm/_logs/2019-08-28debug.log
|
126
|
+
(1/5) Installing nghttp2-libs (1.39.2-r0)
|
127
|
+
(2/5) Installing libcurl (7.65.1-r0)
|
128
|
+
(3/5) Installing expat (2.2.7-r0)
|
129
|
+
(4/5) Installing pcre2 (10.33-r0)
|
130
|
+
(5/5) Installing git (2.22.0-r0)
|
131
|
+
Executing busybox-1.30.1-r2.trigger
|
132
|
+
OK: 96 MiB in 50 packages
|
133
|
+
Removing intermediate container
|
134
|
+
--->
|
135
|
+
Step 3/5 : WORKDIR /app/reactbeginnersguide
|
136
|
+
---> Running in
|
137
|
+
Removing intermediate container 0
|
138
|
+
--->
|
139
|
+
Step 4/5 : EXPOSE 8080
|
140
|
+
---> Running in
|
141
|
+
Removing intermediate container
|
142
|
+
--->
|
143
|
+
Step 5/5 : CMD nginx -g "daemon off;"
|
144
|
+
---> Running in
|
145
|
+
Removing intermediate container
|
146
|
+
--->
|
147
|
+
|
148
|
+
Successfully built
|
149
|
+
Successfully tagged react_webserver:latest
|
150
|
+
|
151
|
+
```
|
152
|
+
|
153
|
+
```up.sh
|
154
|
+
|
155
|
+
$docker-compose up -d --build
|
156
|
+
Creating network "react_default" with the default driver
|
157
|
+
Building webserver
|
158
|
+
Step 1/5 : FROM nginx:mainline-alpine
|
159
|
+
--->
|
160
|
+
Step 2/5 : RUN apk update; apk add nodejs npm; npm install -g browserify; npm install -g babel-cli; apk add git;
|
161
|
+
---> Using cache
|
162
|
+
--->
|
163
|
+
Step 3/5 : WORKDIR /app/react
|
164
|
+
---> Using cache
|
165
|
+
--->
|
166
|
+
Step 4/5 : EXPOSE 8080
|
167
|
+
---> Using cache
|
168
|
+
--->
|
169
|
+
Step 5/5 : CMD nginx -g "daemon off;"
|
170
|
+
---> Using cache
|
171
|
+
--->
|
172
|
+
|
173
|
+
Successfully built
|
174
|
+
Successfully tagged react_webserver:latest
|
175
|
+
Creating nginx ... done
|
176
|
+
|
177
|
+
```
|
178
|
+
|
179
|
+
```exec.sh
|
180
|
+
|
181
|
+
$docker exec -it nginx /bin/sh
|
182
|
+
/app # browserify --version
|
183
|
+
/bin/sh: browserify: not found
|
184
|
+
/app # babel --version
|
185
|
+
/bin/sh: babel: not found
|
186
|
+
|
187
|
+
```
|