typegoose/mongodb-memory-server

Can't connect to dockerized mongodb-memory-server replica set running as a service in GitLab

Open

#815 建立於 2023年10月18日

在 GitHub 查看
 (11 留言) (0 反應) (0 負責人)TypeScript (188 fork)github user discovery
help wantedquestion

倉庫指標

Star
 (2,828 star)
PR 合併指標
 (PR 指標待抓取)

描述

NodeJS: 18 mongodb-memory-server-*: 9.0.1 mongodb(the binary version): ? mongodb(the js package): 6.1.0 system: Linux / Docker package: mongo-memory-server

What is your question?

I wonder if there is any mongodb-memory-server configuration that might be involved in the fact that I can't connect to the server when running within a docker container as a GitLab CI/CD service in a pipeline's job.

I created this question in StackOverflow with full details https://stackoverflow.com/q/77315673/2948212 but basically I have dockerized the application here https://gitlab.com/sunnyatticsoftware/mongodb-rs binding IPs to all and using a replica set, and it's all good when I test it locally

docker run --name mongodbrs -p 27017:27017 registry.gitlab.com/sunnyatticsoftware/mongodb-rs

and I can properly connect to mongodb://127.0.0.1:27017/?replicaSet=rs0

And it's also good when I run the docker container and I connect to the application through a hostname alias like mongors where there is an entry on my /etc/hosts pointing mongors to 127.0.0.1 so that I can use connection string

mongodb://mongors:27017/?replicaSet=rs0

But in GitLab CI/CD the connectivity fails. See https://gitlab.com/sunnyatticsoftware/mongodb-rs-tester/-/jobs/5319052214

Is this something related to mongodb-memory-server configuration?

貢獻者指南