NodeJS MongoDB API in Docker Container cant connect to Database running on Host

Questions : NodeJS MongoDB API in Docker Container cant connect to Database running on Host


I have a MongoDB Database set up on my programming host server and a docker container Learning running on that host with a NodeJS Earhost application. In that application, I try most effective to connect to the Database on the host wrong idea but the request always times out.

I set the network to "host" and used the use of case adress "host.docker.internal". I also United tried installing mongodb-shell and it Modern actually works! So basically I can ecudated connect to the database with the shell some how in the container but not with the anything else MongoDB NodeJS API.

Code of the NodeJS application:

const mongodb = _OFFSET);  require('mongodb');

using mongo (-SMALL not at all mongodb://host.docker.internal:27017/ in very usefull the shell works and I connect correctly.

Total Answers 1

Answers 1 : of NodeJS MongoDB API in Docker Container cant connect to Database running on Host

I finally found out the issue. I had to localhost bind it to the correct IPs / in my love of them config I used the argument localtext --bind_ip_all.

Thanks a lot for the help!

Top rated topics

Set height and width of Google Map

Java Safelist Add <head> Tag to Allowed List

First time doing POST request with Spotify's API

Jpackage MSI upgrade does not complete if application is open

Express-session crashes server on setting cookie?

How to permanently delete a Virtual Audio Device from MacOS Sound's preferences?

How to rename a column header with a specific string from that header

MsDeploy and PowerShell: getting 'Error: Unrecognized argument '"=Default Web Site/Folder"'. All arguments must begin with "-"'

Facebook NeuralProphet - Generating model file

ActiveMQ prevents our application server from being stopped

Mail Merge With Python

Packages reference in java

Pivot two columns and keep the values same in sql

ITfoxtec Identity.Saml2.MvcCore -- SAML ERROR Form key length limit 2048 exceeded

How to implement monadic do notation using a Coroutine?

Optimistic UI and api secrets

SwiftUI: When I unlock apps it takes me back to the list

Autocomplete through form

Sorting multiple pandas columns and calculating value percent greater than zero

Azure Functions app + Auth0 provider, getting 401 when calling API with auth token

St_buffer "missing" part of multipolygon using sf in R

Inheriting a JFrame from another class using actionlistener

No analytics cookies is set upon a consent was updated

How i use autofac in zero

Bad Gateway with Spring Boot application behind traefik 2

Using getter and setter in main method

React-native: Migration from javascript to typescript

Drools, accumulate sum and then max

Facebook NeuralProphet - Loading model from pickle for prediction

Xamarin.Forms Sqlite (sometimes) fetching bad result after update

How can I structure a Django REST API for a lot of similar online games?

OpenCL: clBuildProgram Fails without log

Making async calls in ChangeNotifierProxyProvider

JDA 5; The Specified ID is not a valid snowflake

Rest Api pagination - same path for links (self, next, last)

Iterating through text files in blob storage, using Azure functions

How to Resolve a AudioFlinger server died! Error in Android?

Trouble using Insetposition for Inset Axes with Cartopy

Unit test with Kotlin Channel

Getting error when run test using pom.xml file java.lang.NullPointerException: Cannot invoke "" because "ruleStatus" is null

Issue merging PDFs on iText7

Light and dark theme for my Maui Blazor app

Best way to perform arbitrary operations on groups with Dask DataFrames

TypeError: Cannot read properties of undefined using reactjs and graphql

How can i solve this error TypeError: Cannot read properties of null (reading 'indexOf') in my redux application

Is there a way to implement VBA-Workbook_SheetChange across all sheets of a workbook for changing the cell color?

How Empty folder "Delete All" in outlook plugin

How to prevent a java Timer method from resetting panels in a jFrame

GridBagLayout component stretched

How to show camera focus rectangle with Android CameraX