K
K
ksim_miloff2016-08-14 19:37:53
Docker
ksim_miloff, 2016-08-14 19:37:53

How to connect from a docker container to a monge outside of docker?

Hello,
I can say that I just started working with docker and I had difficulties with configuring the dev machine. I can’t connect from an application running in a container to a monge that works the old fashioned way, outside of docker. For the sake of the test, I launched mongo in the docker - it worked, but I don’t want to, because. there are some old projects that don't know anything about docker yet. And the project itself will not use docker for mongo in combat, because. the base lies on a separate server.
In general, I can’t connect to localhost:27017 from the dev container. It seems to me that this is the solution , but something doesn’t work for me today :(.
Thanks for the help.
PS I use docker-compose.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mureevms, 2016-08-15
@ksim_miloff

Colleague Karmashkin says correctly, make the network into host mode. In docker-compose it looks like this:

services:
  service-name:
    container_name: service-name
    build: images/service-name
    network_mode: host

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question