docker react does not work in localhost

后端 未结 2 1188
青春惊慌失措
青春惊慌失措 2021-01-28 19:48

I am trying to run my react app with docker, when I run the container, everything seems fine but I can\'t access it on localhost (or 127.0.0.1). Here is my configuration:

<
相关标签:
2条回答
  • 2021-01-28 19:53

    A container must be started before you can run a command in it.

    docker start seyaa/client
    

    Then you may run eg. a shell

    docker run seyaa/client /bin/sh
    
    0 讨论(0)
  • 2021-01-28 20:13

    If that's the output from your container, then you're listening on localhost in the container, which is not the same as on the host. Make the server listen on 0.0.0.0 instead of localhost (check this post) then try hitting localhost on your host machine. You're also not exposing any ports through to your host by the looks of it, so you'll also need to change your docker run to be something like docker run -p 8090:8090 seyaa/client.

    0 讨论(0)
提交回复
热议问题