docker-YApi
docker-YApi copied to clipboard
设置YAPI_DB_USER、YAPI_DB_PASS之后,yapi-web运行报错
设置了YAPI_DB_USER、YAPI_DB_PASS之后,yapi-web容器貌似无法正常连接上MongoDB,打印如下日志: error: MongoNetworkError: Authentication failed., mongodb Authentication failed
YAPI_DB_AUTH_SOURCE: admin
这行配置必须要有
version: '3'
services:
yapi-web:
image: jayfong/yapi:latest
container_name: yapi-web
ports:
- 9400:3000
environment:
YAPI_ADMIN_ACCOUNT: [email protected]
YAPI_ADMIN_PASSWORD: adm1n
YAPI_CLOSE_REGISTER: 'true'
YAPI_DB_SERVERNAME: yapi-mongo
YAPI_DB_PORT: 27017
YAPI_DB_DATABASE: yapi
YAPI_MAIL_ENABLE: 'false'
YAPI_LDAP_LOGIN_ENABLE: 'false'
YAPI_PLUGINS: '[]'
YAPI_DB_AUTH_SOURCE: admin
YAPI_DB_USER: root
YAPI_DB_PASS: 123456
depends_on:
- yapi-mongo
links:
- yapi-mongo
restart: unless-stopped
yapi-mongo:
image: mongo:latest
container_name: yapi-mongo
environment:
MONGO_INITDB_DATABASE: yapi
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: 123456
volumes:
- ./data/db:/data/db
expose:
- 27017
restart: unless-stopped
YAPI_DB_AUTH_SOURCE: admin
这行配置必须要有version: '3' services: yapi-web: image: jayfong/yapi:latest container_name: yapi-web ports: - 9400:3000 environment: YAPI_ADMIN_ACCOUNT: [email protected] YAPI_ADMIN_PASSWORD: adm1n YAPI_CLOSE_REGISTER: 'true' YAPI_DB_SERVERNAME: yapi-mongo YAPI_DB_PORT: 27017 YAPI_DB_DATABASE: yapi YAPI_MAIL_ENABLE: 'false' YAPI_LDAP_LOGIN_ENABLE: 'false' YAPI_PLUGINS: '[]' YAPI_DB_AUTH_SOURCE: admin YAPI_DB_USER: root YAPI_DB_PASS: 123456 depends_on: - yapi-mongo links: - yapi-mongo restart: unless-stopped yapi-mongo: image: mongo:latest container_name: yapi-mongo environment: MONGO_INITDB_DATABASE: yapi MONGO_INITDB_ROOT_USERNAME: root MONGO_INITDB_ROOT_PASSWORD: 123456 volumes: - ./data/db:/data/db expose: - 27017 restart: unless-stopped
按照这个来是可以的,谢谢。