0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

docker-composeでReact環境構築できなかった対策

Posted at

##概要
React開発環境をDockerで作ろうとした際に遭遇したエラーに対する対処の備忘です。

##環境

Windows10 ver2004(19041.208)
WSL2
docker 19.03.8
docker-compose 1.25.4

##コンテナ作成
Dockerfile, docker-compose.yml作成は以下を参考にしました。

docker-composeでReact環境構築(@kerochelo様)
https://qiita.com/kerochelo/items/1063da8893026de5ebbf

##起動しない
docker-compose up後、勝手に終了する。

PS > docker-compose up
Recreating react_web_1 ... done
Attaching to react_web_1
web_1  | yarn run v1.15.2
web_1  | $ react-scripts start
web_1  | ℹ 「wds」: Project is running at http://172.18.0.2/
web_1  | ℹ 「wds」: webpack output is served from
web_1  | ℹ 「wds」: Content not from webpack is served from /usr/src/app/react-sample/public
web_1  | ℹ 「wds」: 404s will fallback to /
web_1  | Starting the development server...
web_1  |
web_1  | Done in 29.34s.
react_web_1 exited with code 0

##対策

docker-compose run で--service-ports付きで実行する。
これでなぜいけるのかはわからない。

docker-compose run --rm --service-ports web
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?