适用于 apisix、etcd、apisix-dashbaord 的 Docker compose

问题描述 投票:0回答:1

我正在尝试为 apisix、apisix-dashboard 和 etcd 创建一个简单的 docker-compose 设置。它的目的只是启动一个简单的设置,以便在本地进行操作和测试。 不幸的是,apisix-docker Github 存储库中的 apisix 示例无法正常工作,并且文档不完整。

到目前为止,我成功启动了三个容器,但是当我尝试登录 apisix-dashboard 时,出现错误 “请求错误代码:10000 用户名或密码错误”,但没有相应的日志消息。出了什么问题?

这是我的

compose.yaml
:

services:
  # etcd for APISIX configuration storage
  etcd:
    image: bitnami/etcd:3.5.17
    container_name: etcd
    environment:
      ALLOW_NONE_AUTHENTICATION: yes
      ETCD_ADVERTISE_CLIENT_URLS: http://etcd:2379
      ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379
    ports:
      - "2379:2379"

  # APISIX instance
  apisix:
    image: apache/apisix:3.11.0-debian
    container_name: apisix
    restart: always
    depends_on:
      - etcd
    volumes:
      - ./apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro
    ports:
      - "9080:9080"
      - "9443:9443"
      # - "9091:9091" # APISIX Admin API port (default is 9091)

  # APISIX Dashboard
  apisix-dashboard:
    image: apache/apisix-dashboard:3.0.1-alpine
    container_name: apisix-dashboard
    restart: always
    depends_on:
      - apisix
      - etcd
    volumes:
      - ./dashboard_conf/conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml:ro
    ports:
      - "9000:9000"

apisix_conf/config.yaml

apisix:
  node_listen: 9080          # APISIX listening port for HTTP
  
deployment:
  admin:
    allow_admin:
      - 0.0.0.0/0
    admin_key:
      - name: "admin"
        key: edd1c9f034335f136f87ad84b625c8f1
        role: admin
  etcd:
    host:
      - http://etcd:2379
    prefix: "/apisix"
    timeout: 30

dashboard_conf/conf.yaml

conf:
  listen:
    port: 9000

  etcd:
    endpoints:
      - etcd:2379
      
authentication:
  secret: secret
  users:
    - username: admin
    - password: admin
docker-compose apache-apisix
1个回答
0
投票

错误是

dashboard_conf/conf.yaml
中的这个片段:

  users:
    - username: admin
    - password: admin

应该是:

  users:
    - username: admin
      password: admin
© www.soinside.com 2019 - 2024. All rights reserved.