Skip to content

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

Open
@diegosasw

Description

@diegosasw

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions