LoginSignup
3
0

More than 3 years have passed since last update.

Docker + create-react-app v3.4.1でサーバーが立ち上がらない

Last updated at Posted at 2020-03-28

起きたバグ

react-scripts startでサーバーを立ち上げようとしても

node_1  | yarn run v1.22.4
node_1  | $ react-scripts start
node_1  | ℹ 「wds」: Project is running at http://172.26.0.2/
node_1  | ℹ 「wds」: webpack output is served from 
node_1  | ℹ 「wds」: Content not from webpack is served from /usr/src/app/react-sample/public
node_1  | ℹ 「wds」: 404s will fallback to /
node_1  | Starting the development server...
node_1  | 
node_1  | Done in 25.46s.
docker-react-app_node_1 exited with code 0

というメッセージが表示されサーバーが終了する。

原因

create-react-app v3.4.1で取り込まれた下記の修正

process.stdout.isTTYかprocess.env.CIがtrueじゃないと開発用サーバーが停止するらしい。

解決方法

上のコミットのメッセージに

// Gracefully exit when stdin ends
(標準入力が終了したら正常終了するよ)

とあるので標準入力を終わらせないオプションをdocker-compose.ymlに追加。
具体的には下記のオプション

stdin_open: true

と追加するだけ。

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0