1👍
✅
First
Use directly official node:<version>
image, not ubuntu or other S.O. image.
Best practice is to fix a version.
Node image contains node, npm and S.O. environment.
Second
If you use Docker Compose, in docker-compose.yml
you have to map ports of your service (wich contains node
image) like this:
ports:
- "8080:8080"
where the first is what you call from your browser (http://localhost:8080).
(Ignore eventual separate nginx/webserver container).
If you use Docker directly you run command with -p option, like this:
docker run -p 8080:8080 <container>
0👍
you have to add port mapping see docs
-p 8080:8080 Map TCP port 80 in the container to port 8080 on the Docker host.
Source:stackexchange.com