Cannot access web server using docker

后端 未结 2 1507
陌清茗
陌清茗 2021-01-27 21:30

I used the following command to run the container :

docker run -p 3333:3333 -d maill/node-web-app

Here is the result of docker ps :

<         


        
相关标签:
2条回答
  • 2021-01-27 21:35

    To go along with johnharris85's answer, add the following to your package.json:

    From nuxt documentation on "How to edit HOST and PORT?"

    You can configure the PORT with 3 different ways:

    1. ...
    2. ...
    3. Via a nuxt config in the package.json:

    Inside your package.json:

    "config": {
     "nuxt": {
       "host": "0.0.0.0",
       "port": "3333"
     }
    },
    "scripts": {
     "dev": "nuxt"
    }
    
    0 讨论(0)
  • 2021-01-27 21:47

    Based on what you have in the question so far, and that you have OPEN localhost:3000 coming from your container logs, I'd guess your application is listening on localhost. This is != localhost outside the container. You need to configure your application to listen on 0.0.0.0 inside the container.

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