Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Couldn't connect to server mongo1:30001 #2

Open
manhvd161 opened this issue Aug 2, 2021 · 3 comments
Open

Couldn't connect to server mongo1:30001 #2

manhvd161 opened this issue Aug 2, 2021 · 3 comments

Comments

@manhvd161
Copy link

manhvd161 commented Aug 2, 2021

I followed the instructions but I always get the result like this. Please help me fix this.

docker-compose up

Creating network "devcontainers-mongodb-replica-set-with-docker_netApplication" with the default driver
Creating mongo1 ... done
Creating mongo3 ... done
Creating mongo2 ... done
Creating mongo-setup ... done
Attaching to mongo1, mongo3, mongo2, mongo-setup
mongo-setup | ********************************************** mongo1
mongo-setup | Waiting for startup..
mongo3 exited with code 1
mongo2 exited with code 1
mongo1 exited with code 1
mongo2 exited with code 1
mongo1 exited with code 1
mongo3 exited with code 1
mongo2 exited with code 1
mongo-setup | done
mongo-setup | SETUP.sh time now: 15:31:39
mongo-setup | MongoDB shell version v4.2.15
mongo-setup | connecting to: mongodb://mongo1:30001/?compressors=disabled&gssapiServiceName=mongodb
mongo-setup | 2021-08-02T15:31:40.675+0000 E QUERY [js] Error: couldn't connect to server mongo1:30001, connection attempt failed: SocketException: Error connecting to mongo1:30001 (172.18.0.2:30001) :: caused by :: Connection refused :
mongo-setup | connect@src/mongo/shell/mongo.js:353:17
mongo-setup | @(connect):2:6
mongo-setup | 2021-08-02T15:31:40.677+0000 F - [main] exception: connect failed
mongo-setup | 2021-08-02T15:31:40.677+0000 E - [main] exiting with code 1
mongo1 exited with code 1
mongo3 exited with code 1
mongo2 exited with code 1

@FabioReact
Copy link

@manhvd161 Same here. Did you find the error?
If not, can you provide any help @sntnupl ?

Thank you :)

@federicoarcangeli
Copy link

Hi, same issue. Did you manage to resolve ? @sntnupl

@Shamanga
Copy link

Hello,

The connection problem here indicates that your mongo container is not up and running.
An exit code 1 from a docker container indicates an application error or an incorrect reference to a file that is not present in the container.
In my experience, make sure that the volume mounts in the docker-compose file are all correct, and everything should work. I would recommend also checking for instance if your "file.key" is valid, meaning that it's actually a file.
As an example, if the file.key is for some reason a "folder" and not a file, then the container would exit because it can't read it.

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants