swagger 使用docker启动swagger服务

原创
2019/12/30 11:21
阅读数 7.8K

一、引入jar包

implementation("io.springfox:springfox-swagger2")

二、获取swagger的json文件

项目启动时,访问

/v2/api-docs

此时会获得swagger.json

三、使用docker-compose启动swagger镜像

version: "2"
services:
  swagger:
    image: swaggerapi/swagger-ui
    environment:
      - SWAGGER_JSON=/swagger/api.json
    volumes:
      - ./swagger:/swagger
    ports:
      - 17888:8080

这里的environment里面关于swagger_json的location指向第二步存储的json文件。

docker-compose up -d

展开阅读全文
加载中

作者的其它热门文章

打赏
0
0 收藏
分享
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部