GithubHelp home page GithubHelp logo

Comments (4)

CoinXu avatar CoinXu commented on June 28, 2024 3

windows下只能使用volume,不能直接bind磁盘。

  1. 创建volume
docker volume create mongodata
docker volume create redisdata
docker volume create logsdata
  1. docker-compose.yml修改如下
version: "3.3"
services:
  mongodb:
    image: mongo:3.4
    volumes:
      - type: volume
        source: mongodata
        target: /data/db
  redis:
    image: redis:4.0.6
    command: redis-server --appendonly yes
    volumes:
      - type: volume
        source: redisdata
        target: /data
  web:
    image: easymock/easymock:1.5.1
    command: /bin/bash -c "npm start"
    links:
      - mongodb:mongodb
    ports:
      - 7300:7300
    volumes:
      - type: volume
        source: logsdata # 日志地址,根据需要修改为本地地址
        target: /home/easy-mock/easy-mock/logs
      - type: bind
        source: ./production.json # 配置地址,请使用本地配置地址替换
        target: /home/easy-mock/easy-mock/config/production.json

# 一定要声明volumes
volumes:
  mongodata:
    external:
      name: mongodata
  redisdata:
    external:
      name: redisdata
  logsdata:
    external:
      name: logsdata
  1. 删除production.js中的db配置
  2. 运行docker-compose up -d

from easy-mock-docker.

DuanPengfei avatar DuanPengfei commented on June 28, 2024

提供下

  • 系统版本
  • Docker 版本
  • 使用子系统还是直接 Windows 版本 Docker
  • easy-mock 镜像版本

我们看看是否可以复现。

from easy-mock-docker.

reuwi avatar reuwi commented on June 28, 2024

@DuanPengfei 使用的Windows 版本 Docker,貌似是因为Mongodb 不支持直接映射,只能使用具名volume

The default Docker setup on Windows and OS X uses a VirtualBox VM to host the Docker daemon. Unfortunately, the mechanism VirtualBox uses to share folders between the host system and the Docker container is not compatible with the memory mapped files used by MongoDB (see vbox bug, docs.mongodb.org and related jira.mongodb.org bug). This means that it is not possible to run a MongoDB container with the data directory mapped to the host.

from easy-mock-docker.

DuanPengfei avatar DuanPengfei commented on June 28, 2024

@CoinXu 感觉可以提个 PR 直接升级下原项目的 docker-compose 了,这样就可以尽最大可能兼容各种场景,让大家真正做到开箱即用😄

from easy-mock-docker.

Related Issues (20)

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.