Comments (5)
I think your problem is because you are only opening port 3000, can you try changing EXPOSE 3000
to EXPOSE 3000 27017 27018 27019
see if that does the trick.
from run-rs.
I updated the run command to bind ports 27017, 27018, 27019 and also the EXPOSE directive in the Dockerfile but I still get the connection refused.
from run-rs.
I got mine running, try the following when you run the container:
docker run -ti -p 27017-27019:27017-27019 --network="host" --name mongo-runrs YOURIMAGEID
If you don't define --network="host"
then you won't be able to connect to the container using localhost.
Hope this helps.
from run-rs.
I still get the same error. Note that when we use "host" network mode the published ports are discarded.
docker run -it -p 27017-27019 --network="host" --name my-api --env-file RS.env my-api
WARNING: Published ports are discarded when using host network mode
> [email protected] start /src
> node --inspect server
Debugger listening on ws://127.0.0.1:9229/fe5f0b84-faa4-40eb-bb0f-037ccb27f3fd
For help, see: https://nodejs.org/en/docs/inspector
debug: Mongoose connecting to mongodb://localhost:27017,localhost:27018,localhost:27019/my-db?replicaSet=rs with options {"useCreateIndex":true,"useNewUrlParser":true,"useUnifiedTopology":true,"useFindAndModify":false,"timestamp":"2020-10-27T12:06:34.295Z"}
info: Request logging set to: false {"timestamp":"2020-10-27T12:06:34.414Z"}
info: MY API Express app starting on port 3000 with log level silly {"timestamp":"2020-10-27T12:06:34.415Z"}
error: UnhandledRejection Error: connect ECONNREFUSED 127.0.0.1:27017 {"timestamp":"2020-10-27T12:07:04.311Z"}
error: connect ECONNREFUSED 127.0.0.1:27017 {"reason":{"type":"ReplicaSetNoPrimary","setName":"rs","maxSetVersion":1,"maxElectionId":"7fffffff00000000000000a5","servers":{},"stale":false,"compatible":true,"compatibilityError":null,"logicalSessionTimeoutMinutes":null,"heartbeatFrequencyMS":10000,"localThresholdMS":15,"commonWireVersion":7}}
from run-rs.
I'm facing the same issue, where client is disconnected arbitrarily saying MongooseServerSelectionError: connection timeout.
from run-rs.
Related Issues (20)
- Gets stuck on 'Starting replica set...' HOT 8
- MongoDB 4.4.2 fails to start HOT 1
- Unable to start or create replica set with mongodb 4.4.1 HOT 1
- Is it possible to configure the ports? HOT 2
- Warnings HOT 1
- Starting rs with --keep throws an error HOT 1
- Error: Server is unavailable HOT 8
- run-rs nuked my existing databases HOT 1
- colors dependecy attack through prettyjson
- How to uninstall the mongodb rs installed by run-rs in macos?
- moment.js security vulnerability
- --keep option, way to avoid logging entire db contents on start? HOT 1
- No mongod process found at mongod, check your --mongod option
- Error: spawn Unknown system error -86 HOT 2
- Changing default ports with --portStart flag does not work
- Support Apple Silicon
- Not Working with Node Version 18 HOT 1
- Invalid namespace specified error when adding document to collection with feathers-mongodb and run-rs
- mongoDB is no longer available for download for Ubuntu 16.04
- Error "Server is unavailable" with Node >= 17 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from run-rs.