gxthrj commented on a change in pull request #785: URL: https://github.com/apache/apisix-dashboard/pull/785#discussion_r521863418
########## File path: docs/deploy-with-docker.zh-CN.md ########## @@ -17,44 +17,65 @@ # --> -# 使用 Docker 部署 +# 使用 Docker 构建并启动 -1. 构建镜像 +使用 Docker 构建 Dashboard,您只需下载**根目录**中的 `Dockerfile` 文件到您的设备(无需下载源码),并根据本指南操作即可。 + +本构建指南产物中,将包含 `manager-api` 与 `web`。 + +## 环境准备 + +在使用 Docker 构建镜像、启动容器前,请确认您的环境中,已安装并运行如下依赖: + +1. [Docker](https://docs.docker.com/engine/install/) +2. [etcd](https://etcd.io/docs/v3.4.0/dl-build/) 3.4.0+ + +## 构建 ```sh -# 注意:需手动指定 $tag -$ docker build -t apisix-dashboard:{$tag} . +# 在 Dockerfile 所在目录下(默认为项目根目录)执行构建命令,请手动指定 tag。 +$ docker build -t apisix-dashboard:$tag . + +# 对于中国大陆的用户,可启用 `ENABLE_PROXY` 参数加快模块下载速度。 +$ docker build -t apisix-dashboard:$tag . --build-arg ENABLE_PROXY=true ``` -2. 准备配置文件 +## 启动 -在启动容器前,需要在**宿主主机**内准备配置文件 `conf.yaml`,以便覆盖容器内部默认的配置文件。请参考[示例配置文件](./examples/docker-conf-example.yaml)。 +1. 准备配置文件 -示例配置说明: +在启动容器前,需要在**宿主主机**内准备配置文件 `conf.yaml`,以便覆盖容器内部默认的[配置文件](../api/conf/conf.yaml)。 -- `conf.listen.host` 为容器内监听 IP,必须为 `0.0.0.0`,这样宿主才能访问容器内网络。 -- `conf.listen.port` 为容器内监听端口,默认为 `8080`。如需修改,请同步修改 [Dockerfile](../Dockerfile)。 -- `conf.etcd.endpoints` 为 ETCD 主机列表,支持多个节点,请确保容器可以访问到这些主机,例如:示例配置中 `conf.etcd.endpoints` 为 `host.docker.internal` 旨在允许容器访问宿主主机上的网络。 +配置文件有如下注意事项: -3. 启动容器 +- `conf.listen.host` 为 `0.0.0.0` 时,才能使外部网络访问到容器内的服务。 +- `conf.etcd.endpoints` 必须能够在容器内访问 `etcd` 服务。例如:使用 `host.docker.internal:2379` 以便容器能够访问宿主机网络中的 `etcd`。 + +2. 启动 Dashboard ```sh -$ docker run -d -p 80:8080 -v /path/to/conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml --name apisix-dashboard apisix-dashboard:{$tag} +# /path/to/conf.yaml 需使用 绝对路径 指向上述提到的配置文件 +$ docker run -d -p 80:8080 -v /path/to/conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml --name apisix-dashboard apisix-dashboard:$tag ``` -现在你可以在浏览器中通过 `http://127.0.0.1` 使用 Dashboard。 +3. 检查容器是否启动成功 -## 注意 +```sh +$ docker ps -a Review comment: `docker ps` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
