Comment

Peter Bengtsson

What do you mean by "why you must start in the current machine environment"?

Parent comment

Earle West

Can you explain a bit more why you must start in the current machine environment? I'd really like to just pull a container from hub.docker.org that has all this built in...that would allow me to move to other machines and have the same environment

Replies

Mark Winterbottom

Hey Peter, great article. I think what Earle is asking is why do we need to run `create-react-app` locally before creating the Dockerfile? This means that creating new applications requires the correct version of NPM and create-react-app locally before developing it in docker.

KK

I have the exact same question. Creating the app in host machine prior to moving it to the container seems to defeat one of the purposes of using docker which is to avoid installing any softwares in the host machine. I am not sure what I am missing here.

Peter Bengtsson

Good question and I'd have to think about that. Once you've created the project once you won't need `create-react-app` installed. Right? So you don't need that bloat.

One solution would be to do something like

> docker container run -it react:app bash
$ npm add create-react-app
$ create-react-app myinitialproject

And when after you exit, only add the created project to the git repo.