VioletZhouECE commented on issue #300:
URL: https://github.com/apache/apisix-docker/issues/300#issuecomment-1118020414
Gotcha!
Yeah I think we need to document how to use the Docker compose files to
start APISIX.
I started some documentation (still WIP)
In **Run with Docker-compose**, I documented how to use the existing docker
compose file, components/services in the docker compose file, and how the
configs can be modified (maybe we can add more documentations for other common
non-trivial modifications to the docker compose file, but I think most of the
configs are in configs.yaml).
In **Customize APISIX images**, I tried documenting how to customize apisix
images, but I'm not very sure about the exact steps users need to take to build
their own images. Are they supposed to modify the images provided in the repo?
Are the images linked to images in the docker hub? Is `alpine/Dockerfile` the
same as `apache/apisix:2.13.1-alpine`?
### Run with Docker-compose
`/example` contains an example docker-compose file and config files that
show how to start apisix and apisix dashboard using docker compose.
1. Start apisix and apisix dashboard
```
cd example
docker-compose -p docker-apisix up -d
```
2. Check if APISIX is running properly by running this command and checking
the response.
```
curl "http://127.0.0.1:9080/apisix/admin/services/" -H 'X-API-KEY:
edd1c9f034335f136f87ad84b625c8f1'
```
The response indicates that apisix is running successfully:
```
{
"count":0,
"action":"get",
"node":{
"key":"/apisix/services",
"nodes":[],
"dir":true
}
}
```
The example docker compose file defines several services: `apisix-dashboard,
apisix, etcd, web1, web2, prometheus, and grafana`:
`apisix-dashboard, apisix, etcd` are the essential services required for
starting apisix-dashboard, apisix, etcd.
`web1, web2` are services built on top of ningix images used for testing
purposes.
`prometheus, grafana` are services used for exposing metrics of the running
services.
It also creates a bridge network `apisix` which connects all services and a
`etcd_data` volume used by the `etcd` service.
All the services are configured by mounting external configuration files
onto the containers: `./dashboard_conf/conf.yaml` defines the configs for
`apisix-dashboard`; `./apisix_conf/conf.yaml` defines the configs for apisix.
Similarly, configs for etcd, prometheus, and grafana are located in the
corresponding conf.yaml files. If you want to use a config file from a
different path, you need to modify the local config file path in the `volumes`
entry under the corresponding service.
### Customize APISIX images
We provide the following images:
- `/alpine/Dockerfile` builds apisix on alpine.
- `/centos/Dockerfile`builds apisix on centos.
- `/dashboard` contains two docker files - `Dockerfile.alpine` and
`Dockerfile.centos`, which build apisix dashboard on alpine and centos
respectively.
- `/all-in-one` enables you to quickly start apisix on alpine by following
[these
steps](https://github.com/apache/apisix-docker#quick-test-with-all-dependencies-in-one-docker-container).
We also provide some useful commands which build, push, and tar your updated
images.
As an example, these are the commands for apisix-centos images:
- ```make build-on-centos``` : Build apache/apisix:xx-centos image.
- ```make push-on-centos```: Build and push apache/apisix:xx-centos image.
- ```make save-centos-tar```: Save apache/apisix:xx-centos image to a tar
archive located at ```./package``` .
Similar commands exist for apisix-alpine images and apisix dashboard. See
[the makefile](https://github.com/apache/apisix-docker/blob/master/Makefile)
for a full list of commands.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]