编写docker-compose.yml
version: '2.1' services: yapi: image: mrjin/yapi:latest # build: ./ container_name: yapi environment: - VERSION=1.5.6 - LOG_PATH=/tmp/yapi.log - HOME=/home - PORT=3000 - ADMIN_EMAIL=me@jinfeijie.cn - DB_SERVER=mongo - DB_NAME=yapi - DB_PORT=27017 # restart: always ports: - 127.0.0.1:3000:3000 volumes: - ~/data/yapi/log/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 # restart: always ports: - 127.0.0.1:27017:27017 volumes: - ~/data/yapi/mongodb:/data/db #db dir networks: - back-net networks: back-net: external: false
随后执行docker-compose up即可。默认密码为ymfe.org。