Search code examples
javascriptreactjsdockerserverproduction

Cannot access React app from production server


I have a react app which I can run on localhost without any problems. I dockerized it and put it on the production server, and sudo docker ps shows that the container is running. I used sudo docker run --name "name" -d -p "my port":my port" "uri" to run the container, and I made sure to specify the correct port. But when I try to access the app from my browser by putting in the ip of the server and the port, I cannot access it. I am able to access other apps running on this server.

Any ideas as to what I'm doing wrong?


Solution

  • The command in my start script setting the port to be different than the default 3000 was not working in the docker container, although it worked when I ran the program on localhost. So instead, in my run command, I mapped port 3000 to the port I wanted to use on my server.