Daniel J. Lewis
Daniel J. Lewis

Reputation: 87

Prevent Docker from closing connection after 10 minutes with slow mongosh commands?

I'm using Coolify to manage a server, and it installs MongoDB via the Docker image.

When I am in the database via mongosh, any slow commands (like deleting millions of documents or compacting a collection) sort of times out after 10 minutes with the error MongoNetworkError: connection 2 to 127.0.0.1:27017 closed (I'm SSH'd into the server, and thus the MongoDB is accessible via localhost). I say "sort of," because it seems most of the commands continue running, but I never get the response because of that error. For example, a db.collection.deleteMany() should return a JSON object with the count of how many documents were deleted.

Nothing I do on the MongoDB side fixes the problem. But I haven't had this problem when I ran MongoDB on a different server without Docker.

So based on some stuff I see online, I'm starting to suspect Docker could be the problem.

What should I check or change if, indeed, Docker is the cause for this apparent 10-minute limit?

Thanks in advance!

Upvotes: -1

Views: 16

Answers (0)

Related Questions