Docker Community Forums

Share and learn in the Docker community.

How to Connect docker container with local mongoDB database (using go and mongoDB)

docker

(Archanairon) #1

Hi, I am new in a docker community. I am working on go app with docker and mongoDB. I created Dockerfile for my project and using gin for routing in go. When I am hitting my api without docker on browser it works fine, but when I am using docker build and run there is error when I am hitting my api

ERROR:: CreateSession: no reachable servers

Here I am using mongoDB on my local environment, using docker I am just installing packages and running my code. Then why docker gives error on hitting an API

Please give me a suggestion.