Skip to content

MongoServerSelectionError: Server selection timed out after 2000 ms #404

@qianfei11

Description

@qianfei11

commit: 3c5ef041a4d510d74cf8bc4a7ee871d125ab99fe

Timed out in connecting to the MongoDB server:

$ bin/up
Initiating Mongo replica set...
[+] Running 1/1
 ✔ Container mongo  Started                                                                             0.3s 
MongoServerSelectionError: Server selection timed out after 2000 ms
Waiting for Mongo...
MongoServerSelectionError: Server selection timed out after 2000 ms
Waiting for Mongo...
^Cexit status 130

The container is unhealthy:

$ docker ps -a
CONTAINER ID   IMAGE       COMMAND                  CREATED         STATUS                     PORTS       NAMES
4e6f794868a0   mongo:8.0   "docker-entrypoint.s…"   8 minutes ago   Up 8 minutes (unhealthy)   27017/tcp   mongo

OS information:

$ uname -r
6.8.0-87-generic
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04.3 LTS
Release:        24.04
Codename:       noble

Docker version:

$ docker version
Client: Docker Engine - Community
 Version:           28.5.1
 API version:       1.51
 Go version:        go1.24.8
 Git commit:        e180ab8
 Built:             Wed Oct  8 12:17:26 2025
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          28.5.1
  API version:      1.51 (minimum version 1.24)
  Go version:       go1.24.8
  Git commit:       f8215cc
  Built:            Wed Oct  8 12:17:26 2025
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.7.28
  GitCommit:        b98a3aace656320842a23f4a392a33f46af97866
 runc:
  Version:          1.3.0
  GitCommit:        v1.3.0-0-g4ca628d1
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Has anyone encountered this problem? I don't know how to fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions