S
S
shude2018-11-11 00:49:12
Network administration
shude, 2018-11-11 00:49:12

Docker: How to see local network from container?

Good afternoon.
Which day I seem to be struggling with a normal task, but nothing really works out.
There are two servers located on the local network 192.168.101.0/24 , docker is installed on one, and a database without docker is deployed on the second. It is required to connect from the docker container to 192.168.101.10 (the server with the database). This IP is not pinged at all, it is understandable that I am trying to knock on the network inside the container. How can you make the container see the local network? Without using --net=host
In theory, the task should be quite popular, but Google does not say anything sensible on this topic.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Askhat Bikmetov, 2018-11-15
@askhat

A successful attempt to access eth0from a container without using network: host, will be the same as using network: host.
Via CLI flag:
Via Compose:

some-service:
  network_mode: 'host'

https://docs.docker.com/network/host/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question