mongodb-memory-server: When running inside docker, mongoServer.getConnectionString() hangs

mongodb-memory-server: 6.1.1
node: v12.14.0

I started a docker container that runs node, and executed the following commands:

const MongodbMemoryServer = require('mongodb-memory-server').MongoMemoryServer;
const mongoServer = new MongodbMemoryServer();

(async () => {
  await mongoServer.getConnectionString();
  console.log('Done');
})();

Done is never printed, whereas outside docker this works fine

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 3
  • Comments: 34 (1 by maintainers)

Commits related to this issue

Most upvoted comments

@firstnoises

I suggest that appending lsb_release -si -sr to the binaries path would be a good solution to the problem. e.g. ./node_modules/.cache/mongodb-binaries/CentOS 7.4.1708/

no it wouldnt, because mongodb-memory-server checks if the file already exists when yes, dont download it again, and when you not use -global package, it will be installed into <project root>/node_modules/.cache/mongodb-binaries (global will install it to ~/.cache/mongodb-binaries

so, either install and use the -global package, or clear your node_modules/.cache every time, or dont mount it