LoginSignup
0
0

More than 1 year has passed since last update.

Winodws10のubuntuにてDockerでReactNative

Last updated at Posted at 2022-01-08

教材

ありがとうございます。とても参考になりました。

準備

Winsows10 Ubuntu インストール済み

手順

Dockerfile


FROM ubuntu:latest

RUN apt-get update && apt-get install -y curl
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash
RUN apt-get install -y nodejs
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && apt update && apt install -y yarn

ENTRYPOINT [ "/bin/bash"]

WORKDIR /react-sample

Dockerfileがあるディレクトリで以下を実行

docker build . -t react/ubuntu:latest
yarn global add create-react-app
create-react-app react-sample
docker run -p 3000:3000 -v /[ホストのパス]/react-sample:/react-sample -it react/ubuntu:latest
yarn 
yarn start

ほぼ教材にさせていただきました参考サイト通りです。
一点だけ

yarn global add create-react-app

が何故か通らなかったので代わりに
npm install -g create-react-app
を実行しました。

yarn
yarn start
で無事ローカルのブラウザでReactの画面を確認できました。

Dockerメモ

sudo service docker start
起動

sudo docker info
起動確認

sudo docker ps
確認

コンテナから抜けるとき
Winodws上のDockerからSTOPする
またはexitする

終わりに

勉強のためにguthubにpushしました。

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