> For the complete documentation index, see [llms.txt](https://geforce2003.gitbook.io/hims/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://geforce2003.gitbook.io/hims/azure-app-service/deploy-docker-on-appservice/get-test-done-before.../run-test-on-local.md).

# Run Test On Local

對惹，在docker build之前，建議先去[docker hub](https://hub.docker.com/) 申請個人帳號，這樣後續要做CD(持續交付)會比較方便

用你習慣的CLI工具，然後輸入以下的指令，<mark style="color:orange;">**記得替換掉docker\_hub帳號跟image name**</mark>

```
docker build -t 你的docker_hub帳號/docker_image_name .
```

接著docker就會開始各種pull image幫你build你自定義的image了，如下，需要時間可能需要幾分鐘，因為我已經build過，檔案也沒異動過，所以就....很快XD

```
[+] Building 6.1s (13/13) FINISHED
 => [internal] load build definition from Dockerfile                                                               0.0s
 => => transferring dockerfile: 32B                                                                                0.0s
 => [internal] load .dockerignore                                                                                  0.0s
 => => transferring context: 34B                                                                                   0.0s
 => [internal] load metadata for docker.io/library/node:14.18.1                                                    5.8s
 => [auth] library/node:pull token for registry-1.docker.io                                                        0.0s
 => [internal] load build context                                                                                  0.2s
 => => transferring context: 25.30kB                                                                               0.2s
 => [1/7] FROM docker.io/library/node:14.18.1@sha256:abcd954d3941ebd1e12cd995dc10a4994535aa44d47271a91a829a2d1f88  0.0s
 => CACHED [2/7] RUN mkdir -p /usr/src/app                                                                         0.0s
 => CACHED [3/7] WORKDIR /usr/src/app                                                                              0.0s
 => CACHED [4/7] COPY package.json yarn.lock ./                                                                    0.0s
 => CACHED [5/7] RUN yarn install  --frozen-lockfile && yarn cache clean                                           0.0s
 => CACHED [6/7] RUN yarn build --standlone                                                                        0.0s
 => CACHED [7/7] COPY . .                                                                                          0.0s
 => exporting to image                                                                                             0.0s
 => => exporting layers                                                                                            0.0s
 => => writing image sha256:910b04b32abcd905e22c13fad396f4f62f7988b1ce93210d2a012259ef8372a3                       0.0s
 => => naming to docker.io/ducker_hub_account/docker_img_name                                                      0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
```

如果中間都沒有甚麼錯誤訊息的話，就可以開始在自己本機上docker run了\~!

```
 docker run -d --name 自定義的容器名稱 -p 自定義Port:3000 docker_hub帳號/hub上的映象檔名稱
```

![docker run](/files/KuPt9meedkgXtzrdv8fb)

成功的執行docker run之後會得到成功執行的image id，接著就用瀏覽器去預覽看看，<http://localhost:8080>

到這邊就差不多完成了前置作業\~


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://geforce2003.gitbook.io/hims/azure-app-service/deploy-docker-on-appservice/get-test-done-before.../run-test-on-local.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
