Fix lỗi liên quan đến mongodb trên win - nghuuquyen/angiday GitHub Wiki

Khi chạy lệnh docker-compose up trên win mà bị lỗi dưới đây ở container angiday_mongodb1 thì hãy làm như sau để fix.
Vào file docker-compose.yml rồi thêm vào volumes và volumes trong mongodb như bên dưới.


version: '3.1'
services:
  ...
  mongodb:
    build: ./docker/mongodb
    restart: always
    ports:
      - "27017:27017"
    volumes:
      - mongodata:/data/db
volumes:
  mongodata:

Lỗi ở terminal / cmd:


mongodb_1  | 2018-10-02T07:45:58.634+0000 I CONTROL  [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=c6bccb606f19
mongodb_1  | 2018-10-02T07:45:58.636+0000 I CONTROL  [initandlisten] db version v3.6.8
mongodb_1  | 2018-10-02T07:45:58.636+0000 I CONTROL  [initandlisten] git version: 6bc9ed599c3fa164703346a22bad17e33fa913e4
mongodb_1  | 2018-10-02T07:45:58.636+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.1.0f  25 May 2017
mongodb_1  | 2018-10-02T07:45:58.636+0000 I CONTROL  [initandlisten] allocator: tcmalloc
mongodb_1  | 2018-10-02T07:45:58.636+0000 I CONTROL  [initandlisten] modules: none
mongodb_1  | 2018-10-02T07:45:58.636+0000 I CONTROL  [initandlisten] build environment:
mongodb_1  | 2018-10-02T07:45:58.636+0000 I CONTROL  [initandlisten]     distmod: debian92
mongodb_1  | 2018-10-02T07:45:58.636+0000 I CONTROL  [initandlisten]     distarch: x86_64
mongodb_1  | 2018-10-02T07:45:58.636+0000 I CONTROL  [initandlisten]     target_arch: x86_64
mongodb_1  | 2018-10-02T07:45:58.636+0000 I CONTROL  [initandlisten] options: { net: { bindIpAll: true } }
mongodb_1  | 2018-10-02T07:45:58.642+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=478M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),cache_cursors=false,compatibility=(release="3.0",require_max="3.0"),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
mongodb_1  | 2018-10-02T07:45:59.666+0000 E STORAGE  [initandlisten] WiredTiger error (17) [1538466359:666622][1:0x7fb3b5c58580], connection: /data/db/WiredTiger.wt: handle-open: open: File exists
mongodb_1  | 2018-10-02T07:45:59.950+0000 I STORAGE  [initandlisten] WiredTiger message unexpected file WiredTiger.wt found, renamed to WiredTiger.wt.213
mongodb_1  | 2018-10-02T07:45:59.952+0000 E STORAGE  [initandlisten] WiredTiger error (1) [1538466359:952319][1:0x7fb3b5c58580], connection: /data/db/WiredTiger.wt: handle-open: open: Operation not permitted
mongodb_1  | 2018-10-02T07:45:59.953+0000 E -        [initandlisten] Assertion: 28595:1: Operation not permitted src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 421
mongodb_1  | 2018-10-02T07:45:59.959+0000 I STORAGE  [initandlisten] exception in initAndListen: Location28595: 1: Operation not permitted, terminating
mongodb_1  | 2018-10-02T07:45:59.960+0000 I NETWORK  [initandlisten] shutdown: going to close listening sockets...
mongodb_1  | 2018-10-02T07:45:59.960+0000 I NETWORK  [initandlisten] removing socket file: /tmp/mongodb-27017.sock
mongodb_1  | 2018-10-02T07:45:59.960+0000 I CONTROL  [initandlisten] now exiting
mongodb_1  | 2018-10-02T07:45:59.960+0000 I CONTROL  [initandlisten] shutting down with code:100
⚠️ **GitHub.com Fallback** ⚠️