docker部署yapi

docker部署yapi

1、安装docker

参考

2、安装docker-compose

参考

3、安装docker-yapi

创建docker-compose.yml配置文件
mkdir -p /export/server/docker/yapi
cd /export/server/docker/yapi
vim docker-compose.yml
version: '3'                                                                                                                         
                                                                                                                                 
services:                                                                                                                            
  yapi-web:                                                                                                                          
    image: jayfong/yapi:1.9.1  # 此处yapi-web修改为1.9.1版本                                                                         
    container_name: yapi-web                                                                                                         
    ports:                                                                                                                           
      - 3000:3000                                                                                                                   
    environment:                                                                                                                     
      - [email protected]                                                                                           
      - YAPI_ADMIN_PASSWORD=admin                                                                                                    
      - YAPI_CLOSE_REGISTER=true                                                                                                     
      - YAPI_DB_SERVERNAME=yapi-mongo                                                                                                
      - YAPI_DB_PORT=27017                                                                                                           
      - YAPI_DB_DATABASE=yapi                                                                                                        
      - YAPI_MAIL_ENABLE=false                                                                                                       
      - YAPI_LDAP_LOGIN_ENABLE=false                                                                                                 
      - YAPI_PLUGINS=[]                                                                                                              
    depends_on:                                                                                                                      
      - yapi-mongo                                                                                                                   
    links:                                                                                                                           
      - yapi-mongo                                                                                                                   
    restart: unless-stopped                                                                                                          
  yapi-mongo:                                                                                                                        
    image: mongo:4.4.4  # 此处yapi-mongo修改为4.4.4版本                                                                              
    container_name: yapi-mongo                                                                                                       
    volumes:                                                                                                                         
      - ./data/db:/data/db 

保存

启动服务
docker-compose up -d

4、测试:

地址栏输入: http://部署机器的ip:3000/ 进行访问

docker部署yapi_第1张图片

你可能感兴趣的:(docker,yapi,容器)