specter_93
specter_93

Reputation: 9

Running a react app inside a linux docker container

I created a Linux container in docker with all the packages and dependencies I need it for my school project. I am aware you can deploy react app containers and use Docker for deployment, although I did not want that. I just need it a Linux container with everything installed so all the members in the team will use the same versions of npm and node. After building the container I ran inside my workdir folder:

npx create-react-app my-app cd my-app npm start

and this is what it shows enter image description here

which means that the app is running locally in my computer how can I see it locally in my PC?

Upvotes: 1

Views: 264

Answers (1)

user2932688
user2932688

Reputation: 1694

use this to run your image:

docker run -d -p 8080:8080 my_image

-p 8080:808 - will map your docker container port to your localhost 8080 port, and you should be able to just go on http://localhost:8080 to see it. (assuming that npm start is starting server on 8080 inside of your docker)

-d means in detached mode, your going to start docker and stay outside of it.

Upvotes: 2

Related Questions