Jdruwe
Jdruwe

Reputation: 3520

Docker MongoDB can't access from outside VM

I am new to docker and I was following a tutorial to combine microservices (written using Spring boot) and docker: http://www.3pillarglobal.com/insights/building-a-microservice-architecture-with-spring-boot-and-docker-part-iii.

My app (server NOT running as a docker container) is able to store data in the mongodb (running as a docker container). When I do requests to my app (rest) using postman I should get a json as return value but that does not happen (I do get a status code '200'), the same thing for every MongoDB UI out there:

empty database

When I open a shell in the MongoDB container and query my database it shows that I have data in my collection:

data in db

Can somebody please explain what I am doing wrong or how I can allow access from my host environment?

UPDATE:

I forgot to implement getter and setter methods for my pojo object. I now get a correct response back in postman.

postman post request

One problem left, I still can't view the data in robomongo (MongoDB UI)

docker ps:

docker ps -a

Upvotes: 0

Views: 307

Answers (1)

Jdruwe
Jdruwe

Reputation: 3520

I was using Robomongo which does not support higher MongoDB versions. I am now using mongochef which works just fine.

Upvotes: 1

Related Questions