Container connection


I edited your posts to add code blocks. Please, format your posts next time according to the following guide: How to format your forum posts
In short: please, use </> button to share codes, terminal outputs, error messages or anything that can contain special characters which would be interpreted by the MarkDown filter. Use the preview feature to make sure your text is formatted as you would expect it and check your post after you have sent it so you can still fix it.

Example code block:

```
echo "I am a code."
echo "An athletic one, and I wanna run."
```

Regarding the issue

Localhost is localhost of the container in which you use it. You could use the service name which is “mongo” if your services were in one compose file.

Otherwise you need to use the host IP address or in case of Docker Desktop, use host.docker.internal.

You can read about why it is neccessary here: Docker network and network namespaces in practice - DEV Community

If you want something similar for Docker CE, you can implement that as described here: Host.docker.internal in production environment - #4 by rimelek

Or you can use an external network to be able to use the service name even when you have separate compose projects.