1.安装docker
wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo
yum install docker-ce -y
systemctl start docker
systemctl enable docker
systemctl status docker
2.使用 Docker 构建 Yapi
2.1启动 MongoDB
docker run -d --name mongo-yapi mongo
2.2获取 Yapi 镜像
docker pull registry.cn-hangzhou.aliyuncs.com/anoy/yapi
2.3初始化 Yapi 数据库索引及管理员账号
docker run -it --rm \
--link mongo-yapi:mongo \
--entrypoint npm \
--workdir /api/vendors \
registry.cn-hangzhou.aliyuncs.com/anoy/yapi \
run install-server
2.4启动 Yapi 服务
docker run -d \
--name yapi \
--link mongo-yapi:mongo \
--workdir /api/vendors \
-p 3000:3000 \
registry.cn-hangzhou.aliyuncs.com/anoy/yapi \
server/app.js
2.5访问 http://localhost:3000 登录账号 admin@admin.com,密码 ymfe.org