My whole application already dockerize & I want to add mogodb database in our project. here is following code
serverAPIOption := options.ServerAPI(options.ServerAPIVersion1)
clientOptions := options.Client().ApplyURI(“mongodb+srv://enigma:@cluster0.ckk7d.mongodb.net/enigma?retryWrites=true&w=majority”).
SetServerAPIOptions(serverAPIOption)client, err := mongo.NewClient(clientOptions)
if err != nil {
log.Fatalln(“Error create client object :”, err)
return &mongo.Client{}
}
docker run --rm --hostname=wizdwarfs --net=host -p 127.0.0.1:5000:5000 -v app:/app/app_data -it v0b
2022/05/12 12:16:11 Error create client object : error parsing uri: lookup cluster0.ckk7d.mongodb.net on 127.0.0.53:53: cannot unmarshal DNS message, Please help. --net=host allow you to connect with internet; either this cause by docker or some technical issue