1
votes

I am trying to Dockerize a web app I built using node.js and MongoDB, but when I run docker-compose up I am getting the following error:

$ docker-compose up

Creating network "nodeapp1_default" with the default driver Creating mongo ... done Creating app ... done Attaching to mongo, app mongo
| 2019-02-05T15:02:34.925+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none' mongo | 2019-02-05T15:02:34.934+0000 I CONTROL [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=e4fb5b7aa837 mongo | 2019-02-05T15:02:34.934+0000 I CONTROL [initandlisten] db version v4.0.5 mongo | 2019-02-05T15:02:34.935+0000 I CONTROL [initandlisten] git version: 3739429dd92b92d1b0ab120911a23d50bf03c412 mongo | 2019-02-05T15:02:34.935+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016 mongo | 2019-02-05T15:02:34.935+0000 I CONTROL [initandlisten] allocator: tcmalloc mongo | 2019-02-05T15:02:34.936+0000 I CONTROL [initandlisten] modules: none mongo | 2019-02-05T15:02:34.936+0000 I CONTROL [initandlisten] build environment: mongo | 2019-02-05T15:02:34.936+0000 I CONTROL [initandlisten] distmod: ubuntu1604 mongo | 2019-02-05T15:02:34.937+0000 I CONTROL [initandlisten] distarch: x86_64 mongo | 2019-02-05T15:02:34.937+0000 I CONTROL [initandlisten]
target_arch: x86_64 mongo | 2019-02-05T15:02:34.937+0000 I CONTROL [initandlisten] options: { net: { bindIpAll: true } } mongo | 2019-02-05T15:02:34.941+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=256M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress), mongo | 2019-02-05T15:02:36.060+0000 E STORAGE [initandlisten] WiredTiger error (17) [1549378956:60130][1:0x7f0c375e0a40], connection: __posix_open_file, 715: /data/db/WiredTiger.wt: handle-open: open: File exists Raw: [1549378956:60130][1:0x7f0c375e0a40], connection: __posix_open_file, 715: /data/db/WiredTiger.wt: handle-open: open: File exists mongo | 2019-02-05T15:02:36.066+0000 E STORAGE [initandlisten] WiredTiger error (26) [1549378956:66441][1:0x7f0c375e0a40], connection: __posix_fs_rename, 253: /data/db/WiredTiger.wt to /data/db/WiredTiger.wt.1: file-rename: rename: Text file busy Raw: [1549378956:66441][1:0x7f0c375e0a40], connection: __posix_fs_rename, 253: /data/db/WiredTiger.wt to /data/db/WiredTiger.wt.1: file-rename: rename: Text file busy mongo | 2019-02-05T15:02:36.077+0000 E STORAGE [initandlisten] WiredTiger error (17) [1549378956:77316][1:0x7f0c375e0a40], connection: __posix_open_file, 715: /data/db/WiredTiger.wt: handle-open: open: File exists Raw: [1549378956:77316][1:0x7f0c375e0a40], connection: __posix_open_file, 715: /data/db/WiredTiger.wt: handle-open: open: File exists mongo | 2019-02-05T15:02:36.078+0000 E STORAGE [initandlisten] WiredTiger error (26) [1549378956:78533][1:0x7f0c375e0a40], connection: __posix_fs_rename, 253: /data/db/WiredTiger.wt to /data/db/WiredTiger.wt.1: file-rename: rename: Text file busy Raw: [1549378956:78533][1:0x7f0c375e0a40], connection: __posix_fs_rename, 253: /data/db/WiredTiger.wt to /data/db/WiredTiger.wt.1: file-rename: rename: Text file busy mongo | 2019-02-05T15:02:36.090+0000 E STORAGE [initandlisten] WiredTiger error (17) [1549378956:90882][1:0x7f0c375e0a40], connection: __posix_open_file, 715: /data/db/WiredTiger.wt: handle-open: open: File exists Raw: [1549378956:90882][1:0x7f0c375e0a40], connection: __posix_open_file, 715: /data/db/WiredTiger.wt: handle-open: open: File exists mongo | 2019-02-05T15:02:36.092+0000 E STORAGE [initandlisten] WiredTiger error (26) [1549378956:92202][1:0x7f0c375e0a40], connection: __posix_fs_rename, 253: /data/db/WiredTiger.wt to /data/db/WiredTiger.wt.1: file-rename: rename: Text file busy Raw: [1549378956:92202][1:0x7f0c375e0a40], connection: __posix_fs_rename, 253: /data/db/WiredTiger.wt to /data/db/WiredTiger.wt.1: file-rename: rename: Text file busy mongo | 2019-02-05T15:02:36.094+0000 W STORAGE [initandlisten] Failed to start up WiredTiger under any compatibility version. mongo | 2019-02-05T15:02:36.094+0000 F STORAGE [initandlisten] Reason: 26: Text file busy mongo | 2019-02-05T15:02:36.094+0000 F - [initandlisten] Fatal Assertion 28595 at src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 638 mongo
| 2019-02-05T15:02:36.094+0000 F - [initandlisten] mongo | mongo | ***aborting after fassert() failure mongo | mongo | mongo exited with code 14

Here is my Dockerfile:

FROM node:8

WORKDIR /usr/src/app

COPY package*.json ./

RUN npm install

COPY . .

EXPOSE 3000 CMD [ "npm", "start" ]

and my docker-compose.yml file:

version: "2" services: app: container_name: app restart: always build: . ports: - "3000:3000" links: - mongo mongo: container_name: mongo image: mongo volumes: - ./data:/data/db ports: - "27017:27017"

The problem seems to be coming from some file called WhiteTiger.wt. I have tried erasing this file from the data directory of my project directory but that did not work. Has anyone come across this problem before?

Thank you

1

1 Answers

3
votes

I am assuming you are running Docker on Windows, and if so, I experienced the same issue and found the answer in the below post:

Windows Docker mongo container doesn't work with volume mount

The problem is that the volume mount is specified as a host volume. I resolved my issue by changing my volume mount to be a named volume. If you need to use host, you might be able to use the rsync tool specified in the answer to the question I linked.

My docker-compose.yml file

version: '3'
services:

  mongodb1:
    image: mongo:latest
    restart: always
    volumes:
      - data1:/data/db
      - config1:/data/configdb
    ports:
      - 30001:27017
    entrypoint: [ "/usr/bin/mongod", "--bind_ip_all", "--replSet", "rs0" ]
volumes:
  data1:
  config1: