Docker 下 Yapi 重置管理员账号/密码

1、Yapi 服务已启动

[root@Tseng-HW ~]# docker ps
CONTAINER ID   IMAGE                                         COMMAND                  CREATED        STATUS          PORTS                                                  NAMES
bec094e7ec66   registry.cn-hangzhou.aliyuncs.com/anoy/yapi   "node server/app.js"     6 weeks ago    Up 13 minutes   0.0.0.0:3001->3000/tcp, :::3001->3000/tcp              yapi
f2348ddaafe9   mongo                                         "docker-entrypoint.s…"   6 weeks ago    Up 29 minutes   27017/tcp                                              yapimongo
[root@Tseng-HW ~]#

2、进入服务

[root@Tseng-HW ~]# docker exec -it yapi sh
/api/vendors #

3、修改config.json文件,创建新的管理员账户

/api/vendors # cd ..
/api # ls
config.json  init.lock    log          vendors
/api # cat config.json 
{
  "port": "3000",
  "adminAccount": "[email protected]",
  "db": {
    "servername": "mongo",
    "DATABASE": "yapi",
    "port": 27017
  }
}
/api # vi config.json
/api # cat config.json 
{
  "port": "3000",
  "adminAccount": "[email protected]",
  "db": {
    "servername": "mongo",
    "DATABASE": "yapi",
    "port": 27017
  }
}

4、使新账户生效,并生成初始密码

/api # cd vendors/
/api/vendors # ls
CHANGELOG.md         config_example.json  package-lock.json    webpack.alias.js
LICENSE              docs                 package.json         yapi-base-flow.jpg
README.md            exts                 plugin.json          ydoc.js
X64                  node_modules         server               ydocfile.js
client               nodemon.json         static               ykit.config.js
common               npm-publish.js       test
/api/vendors # npm run install-server

> [email protected] install-server /api/vendors
>  node server/install.js

log: mongodb load success...
初始化管理员账号成功,账号名:"[email protected]",密码:"ymfe.org"
/api/vendors # 

5、重启Yapi Docker 服务

[root@Tseng-HW ~]# docker restart bec094e7ec66
bec094e7ec66
[root@Tseng-HW ~]#

6、重新登录新管理员账户并修改初始密码

Docker 下 Yapi 重置管理员账号/密码_第1张图片

你可能感兴趣的:(docker)