Dear Abdul Shaik
Your question sounds, like that you don't have much experience with
containers.
If I'm wrong, please don't mind and do not read the rest of the mail.
Ok, you are new and I'm definitely not an expert like Daniel. Perhaps
not being an expert, might allow me to get your problem better.
Yes a container can definitely connect to another. In deed this is a
standard use case.
Without any 'tricks' containers share nothing. But when you expose a
containers network port to the external network interface of the host.
(a.b.c.d), this is visible to all containers.
As example we have:
- A Webservice (Container01) with its port 80 mapped to the hosts port 2000
- A Database (Container02) with its port 3361 mapped to the hosts port 3000
*pure basic*
If Container01 wants connect to Container02 it is not possible via
localhost (127.0.0.1) (Each container has it's own localhost, is also
not the hosts localhost). Container01 needs to use the hosts external IP
and the mapped port of Container02 (a.b.c.d:3000).
*bit advanced*
Podman allows you to define 'internal/private' networks. As Daniel
suggested you can use them for the traffic between your containers
without exposing Container02 on the hosts public network. If you don't
want to handle with IPs, you can activate the DNS plugin. see
https://podman.io/getting-started/network
(Docker users are used that DockerCompose is doing this 'magic' for them.)
Hope this helps
Uwe
Sorry to all experts, whom got a headache because of my dummie
description. :)
Am 04.11.21 um 15:55 schrieb Abdul Shaik:
> Hi, there.
>
> I've a question regarding containers using podman.
>
> I've a database in one container. Let's call it 'Container 01'
> And I want other containers to access the database in the 'Container 01'.
>
> Is that possible?
> If so, would you please let me know?
>
> Thanks in advance.
>
> Best regards.
>
> _______________________________________________
> Podman mailing list -- podman(a)lists.podman.io
> To unsubscribe send an email to podman-leave(a)lists.podman.io
>