> For the complete documentation index, see [llms.txt](https://rajan-silwal-1.gitbook.io/product-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rajan-silwal-1.gitbook.io/product-docs/container/docker/docker-image.md).

# Docker image

Here I am using AWS Virtual Machine to run docker. Following are the steps that I am doing in order to run a docker in VM:<br>

&#x20;In the development process I will build image in my local machine and push that image to Docker Hub. Now from docker hub We will clone that image to AWS VM.

&#x20;                       **Running Docker in Local Machine**

&#x20;**Step 1:**  Download and install Docker hub in your computer, signup using your email and sign in

**Step 2:**  Get the web app code from a developer and starting writing Dockerfile\
&#x20;    &#x20;

```
FROM node:14-alpine

WORKDIR /app

COPY package.json . 

RUN npm install

COPY . . 

EXPOSE 80

CMD ["node", "app.js"]
```

**Step 3:** Build this dockerfile and run it using following command:\
&#x20;       **docker build -t test .**

<figure><img src="https://1186894440-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9wnMXVEmEJ7k6VEhLJYN%2Fuploads%2FS9T4n7vl1n7n9CPaqf2d%2FScreen%20Shot%202022-12-27%20at%204.44.53%20PM.png?alt=media&amp;token=22ac7c19-de1f-4600-bc5a-8d87477ac212" alt=""><figcaption></figcaption></figure>

**Step 4:** Run that build image using folloeing command:\
&#x20;    **docker run -d --rm --name test1 -p 80:80 test,** \
\
Here **test** image is running in port 80 with the name **test1**

<figure><img src="https://1186894440-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9wnMXVEmEJ7k6VEhLJYN%2Fuploads%2FGUIosyXqzdoe4QrcByFh%2FScreen%20Shot%202022-12-27%20at%204.49.03%20PM.png?alt=media&amp;token=e27bc101-179e-48e3-999e-560eaa7761c5" alt=""><figcaption></figcaption></figure>

Here is the final output in local machine with **localhost:80**

&#x20;        &#x20;

<figure><img src="https://1186894440-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9wnMXVEmEJ7k6VEhLJYN%2Fuploads%2FaqXNajUctYD8mk1EaETx%2FScreen%20Shot%202022-12-28%20at%209.54.10%20PM.png?alt=media&amp;token=206545ca-d1eb-4ea5-8b4d-e0076f0e2583" alt=""><figcaption></figcaption></figure>
