docker compose 编排yapi

2020-10-24  本文已影响0人  flyjar

yapi包含web服务和数据库服务两个

version: '2.1'
services:
  yapi01:
    image: mrjin/yapi:latest
    privileged: true
    # build: ./
    container_name: yapi
    environment:
      - VERSION=1.5.6
      - LOG_PATH=/tmp/yapi.log
      - HOME=/home
      - PORT=3000
      - ADMIN_EMAIL=deyi@qq.com  #这个是管理员账号
      - DB_SERVER=mongo     #这个就是mongo的容器名称
      - DB_NAME=yapi
      - DB_PORT=27017
    restart: always
    ports:
      - 3000:3000
    volumes:
      - /usr/local/dockerData/yapi/log:/home/vendors/log # log dir
    depends_on:
      - mongo
    entrypoint: "bash /wait-for-it.sh mongo:27017 -- entrypoint.sh"
    networks:
      - back-net
  mongo:
    image: mongo
    container_name: mongo
    privileged: true
    restart: always
    ports:
      - 27017:27017
    volumes:
      - /usr/local/dockerData/yapi/mongodb:/data/db #db dir
    networks:
      - back-net
networks:
  back-net:
    external: true

//要先创建network
创建network:docker network create back-net
//再启动服务
启动服务:docker-compose up -d

yapi的默认密码:ymfe.org
如果不设置账号( - ADMIN_EMAIL)的话 那默认账号就是:admin@admin.com

上一篇下一篇

猜你喜欢

热点阅读