环境:centos7、docker
mkdir -p /data/yapi/mymongo/data docker run -d -p 27017:27017 --name mongo-yapi -v /data/yapi/mymongo/data:/data/db -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=passwd mongo
[root@node-1 yapi]# vi /data/yapi/config.json { "port": "3000", "adminAccount": "admin@admin.com", "timeout":120000, "db": { "servername": "100.98.100.186", "DATABASE": "yapi", "port": 27017, "user": "admin", "pass": "passwd", "authSource": "admin" }, "mail": { "enable": false, "host": "smtp.163.com", "port": 465, "from": "***@163.com", "auth": { "user": "***@163.com", "pass": "*****" } }, "ldapLogin": { "enable": false, "server": "ldap://192.168.5.3:389", "baseDn": "cn=admin,dc=demo,dc=com", "bindPassword": "admin", "searchDn": "dc=demo,dc=com", "searchStandard": "mail", "emailPostfix": "@demo.com", "emailKey": "mail", "usernameKey": "sn" }, "closeRegister": true // 关闭注册 }
docker run -it --rm -v /data/yapi/config.json:/api/config.json --link mongo-yapi:mongo --entrypoint npm --workdir /api/vendors registry.cn-hangzhou.aliyuncs.com/anoy/yapi run install-server
docker run -d -v /data/yapi/config.json:/api/config.json --name yapi --link mongo-yapi:mongo --workdir /api/vendors -p 10001:3000/tcp registry.cn-hangzhou.aliyuncs.com/anoy/yapi server/app.js
原文:https://www.cnblogs.com/wukc/p/14963579.html