Running Nuxt.js in Docker Container build by Paketo.io / Cloud Native Buildpacks Running Nuxt.js in Docker Container build by Paketo.io / Cloud Native Buildpacks docker docker

Running Nuxt.js in Docker Container build by Paketo.io / Cloud Native Buildpacks


I read about the HOST variable in this post , which the whole problem is about! And then I also found this answer, since I now knew what to look for. The Nuxt.js configuration docs state it also:

By default, the Nuxt.js development server host is localhost which isonly accessible from within the host machine. In order to view yourapp on another device you need to modify the host.

And the crucial config is mentioned also:

Host '0.0.0.0' is designated to tell Nuxt.js to resolve a hostaddress, which is accessible to connections outside of the hostmachine (e.g. LAN)

So all we have to do is to define a Docker environment variable --env "HOST=0.0.0.0" and run the Paketo build Container like this:

docker run --rm -i --tty --env "HOST=0.0.0.0" -p 3000:3000 microservice-ui-nuxt-js

Now the Browser should also show our app at http://localhost:3000:

enter image description here

You can try it yourself using the GitHub Container Registry published image of the example project:

docker run --rm -i --tty --env "HOST=0.0.0.0" -p 3000:3000 ghcr.io/jonashackt/microservice-ui-nuxt-js:latest