0
votes

I am using latest MongoDB docker image in Ubuntu Host. Ubuntu version 20.04. I am using the following command to start the container -

docker run --name local_mongo -d -p 27017:27017 mongo

Whenever I am trying to connect to Mongo Server I am getting the following error..

enter image description here

Any pointer will be helpful...

1
Can you add more detail on how you start the mongodb container, how you try to connect to mongodb: is it from the host, from the mongodb container, from another container? And can you copy paste the error and not use an image? Thanks!jmaitrehenry
Please show us the command you used to run your container and the way you configured your MongoDB to run in Replica Set mode.Ali Tou
"Connection reset by peer" often indicates the server requires SSL but the client isn't using it. Does the mongod log provide any more detail?Joe
@jmaitrehenry I am trying to access mongodb in container from host using Mongo shell version 3.6.8Prabhanjan Kumar Mahapatra
@AliTou I have updated the post with the docker command. And I am not sure whether mongo runs with Replica Set mode by default.Prabhanjan Kumar Mahapatra

1 Answers

0
votes

It is not the right answer but after spending some odd 11 hours found the following solution -

  • Downgraded the host OS from Ubuntu 20.04 to Ubuntu 18.04.4 LTS.

As per my limited knowledge working inside docker container should not get impacted even though the HOST OS are different. But at the same time I feel HOST to Container communication has changed in Ubuntu 20.04.

Because when I tried connecting MS SQL Server also in Ubuntu 20.04 as HOST my previous setup stopped working as it was working with Ubuntu 18.04.

So can't really comment whether it is a docker daemon issue or container issue. But something has changed.

Please keep posting your findings so that we can have a working solution in Ubuntu 20.04 as HOST.