fjc0k / docker-YApi

接口管理平台 YApi 的 Docker 镜像。
https://hub.docker.com/r/jayfong/yapi/tags
MIT License
1.11k stars 263 forks source link

如何更改 MongoDB 默认端口 #90

Open liangyuanzu opened 2 years ago

liangyuanzu commented 2 years ago

我的 docker-compose.yml 文件配置

  yapi-web:
    image: jayfong/yapi:latest
    container_name: yapi-web
    ports:
      - 40001:3000
    environment:
      - YAPI_ADMIN_ACCOUNT=xxx
      - YAPI_ADMIN_PASSWORD=xxx
      - YAPI_CLOSE_REGISTER=true
      - YAPI_DB_SERVERNAME=yapi-mongo
      - YAPI_DB_PORT=37017
      - YAPI_DB_DATABASE=yapi
      - YAPI_MAIL_ENABLE=false
      - YAPI_LDAP_LOGIN_ENABLE=false
      - YAPI_PLUGINS=[]
    depends_on:
      - yapi-mongo
    links:
      - yapi-mongo
    restart: unless-stopped
  yapi-mongo:
    image: mongo:latest
    container_name: yapi-mongo
    volumes:
      - ./data/db:/data/db
    expose:
      - 27017
    restart: unless-stopped

将 YAPI_DB_PORT 这个 env 改为 37017 然后重启了 web 和 mongo 都没有用,log 信息一直卡在 等待 MongoDB 服务可用.. 服务器端口也已放开 centos 7.6 docker 20.10.12 docker-compose 1.29.2