---
title: "Discussion on \"How to create a Node App within a Docker container\" | Hashnode"
description: "Discussion on \"How to create a Node App within a Docker container\". Setup\nRequirements\nBefore you go through this fun tutorial ensure:\n\nYou at least have an understanding of javascript and terminal commands.\nYou should know what Docker is and in theory how it works.\nYou have should node and npm installed on your comp..."
url: "https://hashnode.com/posts/how-to-create-a-node-app-within-a-docker-container/5ce5674efc6d4123769342c6"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to create a Node App within a Docker container](https://hashnode.bywachira.com/how-to-create-a-node-app-within-a-docker-container?utm_source=hashnode&utm_medium=feed)

Setup Requirements Before you go through this fun tutorial ensure: You at least have an understanding of javascript and terminal commands. You should know what Docker is and in theory how it works. You have should node and npm installed on your comp...

May 22, 2019 · hashnode.bywachira.com  
Updated Jun 5, 2019  
Read the article

-   [#docker](https://hashnode.com/tag/docker)
-   [#nodejs](https://hashnode.com/tag/nodejs)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#expressjs](https://hashnode.com/tag/expressjs)

## Written by

[wachira\_dev](https://hashnode.com/@wwachira)

@wwachira · Worldwide

  
[View profile](https://hashnode.com/@wwachira)

Maker

## Responses 2

Markdown supported · ⌘↵ to post

[Ofir Aghai](https://hashnode.com/@iofirag)

[Jan 12, 2020](https://hashnode.com/posts/how-to-create-a-node-app-within-a-docker-container/5ce5674efc6d4123769342c6/comment/5e1b229f32d5fad159b68fcf)

run "docker run -it docker\_nodejs\_app" in terminal, but when going to [localhost](http://localhost:3000/) from the browser, i got the error: "This site can't be reached"

help?

[Ofir Aghai](https://hashnode.com/@iofirag)

[Jan 12, 2020](https://hashnode.com/posts/how-to-create-a-node-app-within-a-docker-container/5ce5674efc6d4123769342c6/comment/5e1b229f32d5fad159b68fcf#reply-5e1b29d77a1d3fcc59026970)

run "docker run -p 3000:3000 docker\_nodejs\_app" instead of "docker run -it docker\_nodejs\_app"

solve my problem. :)

also, "EXPOSE 3000:3000" in Dockerfile - didnt work, and should be just: "EXPOSE 3000"

[Soo Hian](https://hashnode.com/@shonendumm)

[Sep 29, 2019](https://hashnode.com/posts/how-to-create-a-node-app-within-a-docker-container/5ce5674efc6d4123769342c6/comment/5d908cbe62b6f53f7d830455)

Hi, thanks for this tutorial. It's really clear and helpful.

I encountered an error when I tried to run the docker image

> Node\\docker\_nodejs\_app>docker run -it docker\_nodejs\_app
> 
> npm ERR! missing script: start

I googled and found that the package.json needs to add this to "scripts" section:

> "start": "node app.js"

then rebuilding the docker image file and running it solves the error.

[wachira\_dev](https://hashnode.com/@wwachira)

[Sep 29, 2019](https://hashnode.com/posts/how-to-create-a-node-app-within-a-docker-container/5ce5674efc6d4123769342c6/comment/5d908cbe62b6f53f7d830455#reply-5d908dd5603e7f3a7dae1b63)

Nice to know the article was helpful
