Coder Social home page Coder Social logo

docker-yapi's Introduction

YApi Docker镜像

YApi: https://github.com/YMFE/yapi/releases

制作本地的yapi docker镜像。

一键启动

初始化并启动

git clone https://github.com/Ryan-Miao/docker-yapi.git
cd docker-yapi
bash build.sh 1.5.10
bash start.sh  init-network
bash start.sh start-mongo
bash start.sh init-mongo
bash start.sh init-yapi
bash start.sh logs-yapi

停止yapi和mongo

bash start.sh stop

再次启动

bash start.sh start-mongo
bash start.sh start-yapi

具体步骤

Step1: run mongodb

create network

docker network create --subnet=172.18.0.0/16 tools-net

run mongodb

docker run  \
--name mongod \
-p 27017:27017  \
-v /data/opt/mongodb/data/configdb:/data/configdb/ \
-v /data/opt/mongodb/data/db/:/data/db/ \
--net tools-net --ip 172.18.0.2 \
-d mongo:4 --auth 

set admin

docker exec -it mongod mongo admin
 
 >db.createUser({ user: 'admin', pwd: 'admin123456', roles: [ { role: "root", db: "admin" } ] });

set yapi

db.auth("admin", "admin123456")
 db.createUser({ 
 user: 'yapi', 
 pwd: 'yapi123456', 
 roles: [ 
 { role: "dbAdmin", db: "yapi" },
 { role: "readWrite", db: "yapi" } 
 ] 
     
 });

Step2 Build docker image

Edit config.json to change adminAccount

Then

sh build.sh 1.5.10

Step3: run yapi and init

start with db initializtion

 docker run -d -p 3001:3001 --name yapi --net tools-net --ip 172.18.0.3 yapi --initdb

or just run

docker run -d -p 3001:3001 --name yapi --net tools-net --ip 172.18.0.3 yapi 

Step4: chek

 docker logs --tail 10 yapi
log: mongodb load success...
初始化管理员账号成功,账号名:"[email protected]",密码:"ymfe.org"
log: 服务已启动,请打开下面链接访问: 
http://127.0.0.1:3001/
log: mongodb load success...

完整部署过程: https://www.cnblogs.com/woshimrf/p/docker-install-yapi.html

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.