Running nuxt js application in Docker
The application inside Docker container by default is accepting network traffic onhttp://127.0.0.1:3000
. This interface does not accept external traffic so no wonder that it does not work. In order to make it work we need to set HOST environmental variable for nuxt app to 0.0.0.0
(all ip addresses). We can do this either in Dockerfile, like this:
FROM node:6.10.2ENV HOST 0.0.0.0# rest of the file
or in package.json in the script's "start" command:
"scripts": { "start": "HOST=0.0.0.0 nuxt start" ...}
Or any other way that will make the nuxt application to listen elsewhere than on localhost inside container only.