------------恢复内容开始------------
废话不说,直接上步骤:
1、先把镜像pull下来
docker pull cabel/yapi:1.8.9
2、安装mongo,若本有mongo,可使用自己的mongo,没有,先安装
下面是mongo的compose文件
version: "3" services: mongo: image: mongo container_name: mongo ports: - "27017:27017" volumes: - "./db:/data/db" - "./configdb:/data/configdb" environment: - TZ=Asia/Shanghai restart: always networks: - mynet networks: mynet: external: true
3、初始化yapi
docker run -it --link mongo --entrypoint npm --network mynet cabel/yapi:1.8.9 run install-server
4、云效yapi
下面是我的yapi的compose文件
version: "3" services: yapi: image: registry.cn-shenzhen.aliyuncs.com/tool-hub/yapi:1.8.9 container_name: yapi ports: - "3000:3000" volumes: - "./api:/api" - "./configdb:/data/configdb" environment: - TZ=Asia/Shanghai restart: always networks: - mynet networks: mynet: external: true
PS:首先要创建一下mynet网络,也可不使用这个网络
至此,搭建完毕