0

I'm trying to understand how a containerized application can communicate
with a non-containerized application, for example a non-containerized database
that could be on the same host or not.
I would like to know which command or setting is needed to make this happen.

2 Answers2

0

For example you can use host network https://docs.docker.com/network/host/

In this way it is as if your application was installed inside the machine even if it is actually inside a container

Mirco
  • 212
  • 3
  • 12
  • Thanks,yes but it's help non-containerized app to comunicate with container but how to make container talk to the uncontainerized application. – Dan Azoulay Feb 06 '19 at 10:39
  • your app should have a configuration file that points to the db inside the container, change it and point to db. I suggest you to use a dockerfile to change the configuration of your app – Mirco Feb 06 '19 at 10:47
  • Ok, but it's possible to pass it through an environment variable rather than write it inside the container? – Dan Azoulay Feb 06 '19 at 10:54
  • depends on the type of image you are using, you can go to the docker hub or the repository where you found it and read the guide that is usually written to create an image or read the dockerfile of the image itself can sometimes help – Mirco Feb 06 '19 at 11:01
0

Docker container can communicate with outside world without any problem
as long as the host that contains the daemon can communicate with the target host.

In the other direction, the container must publish a port through which it becomes accessible from outside

andolsi zied
  • 3,553
  • 2
  • 32
  • 43
  • Yes i understand, but i'm trying to find the best way to create that link. For example if I have several containers that have to be connected to an non-containerized app. What is the best way to configure that link ? – Dan Azoulay Feb 06 '19 at 12:14
  • you can create a proxy container that publish a port for the outside and redirect received request to other containers witch not publish any port. – andolsi zied Feb 06 '19 at 13:20