質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.46%
Docker

Dockerは、Docker社が開発したオープンソースのコンテナー管理ソフトウェアの1つです

Q&A

1回答

721閲覧

DockerでReactアプリケーションを動かしたい

2_34_koki

総合スコア67

Docker

Dockerは、Docker社が開発したオープンソースのコンテナー管理ソフトウェアの1つです

0グッド

0クリップ

投稿2020/10/10 09:00

現在Dockerの学習を通してDockerでReactアプリケーションを動かしたいと思っております.
まず下記の手順を行いました.

$ create-react-app docker-sample-app --template typescript $ cd docker-sample-app $ touch Dockerfile ; touch docker-compose.yml

Dockerfileとdocker-compose.ymlは次のよう定義しました.

FROM node:12.19.0-alpine WORKDIR /usr/src/app
version: "3" services: web: image: sample:latest container_name: sample build: context: . dockerfile: Dockerfile volumes: - ./:/usr/src/app command: "yarn && yarn start" ports: - "3000:3000"

そして下記のコマンドを実行して立ち上がると思ったのですが,うまくいません

$ docker-compose build $ docker-compose up
Attaching to sample sample | yarn install v1.22.5 sample | [1/4] Resolving packages... sample | [2/4] Fetching packages... sample | info fsevents@2.1.2: The platform "linux" is incompatible with this module. sample | info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation. sample | info fsevents@1.2.11: The platform "linux" is incompatible with this module. sample | info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation. sample | [3/4] Linking dependencies... sample | warning " > @testing-library/user-event@7.2.1" has unmet peer dependency "@testing-library/dom@>=5". sample | [4/4] Building fresh packages... sample | Done in 493.68s. sample | yarn run v1.22.5 sample | $ react-scripts start sample | ℹ 「wds」: Project is running at http://172.30.0.2/ sample | ℹ 「wds」: webpack output is served from sample | ℹ 「wds」: Content not from webpack is served from /usr/src/app/public sample | ℹ 「wds」: 404s will fallback to / sample | Starting the development server... sample | sample | Done in 13.26s. sample exited with code 0

よくわからないこと

  • なぜvolumesでマウントしているのにうまく動いていないのか?
  • docker-compose upをすると終了してエラーが出るまで8分ぐらいかかった.

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

コマンドが実行されているdirectoryと配置されたファイルを確認するのがよいのではないでしょうか。

contextでは.(current directory)を指定されているようですが、working_directoryは特に指定されていないようなのでマウントしたファイルを適切に扱えていない可能性があるかと思いました。

参考になりますと幸いです。

投稿2020/10/10 09:48

Ryutooooo

総合スコア6

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.46%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問