How to communicate with one docker container to another docker container?

Hi I am new in docker side I have some doubt about communicating between two docker container’s, I have two docker container’s. One is login page container and other is dashboard container those container port are same 80 but host port differ 82,83 how to communicate login page container to dashboard container I know docker is isolated application but I need to check if possible or not

Hi

You need to put them in the same network, then you can easily reference the containers by their name

Same network means I not get it. I need to login to dashboard page but login and dashboard are individual containers but how to communicate because host port will not come same, then how to communicate each other. any solution.

Yeah now I get it same network only I created but how they communicate ?

you should be able to ping them by their name, so if you have a container named “dashboard” you should be able to ping “dashboard”, frrom your “login” container

I need help. How to ping those things with container name.

Answers can only be as good as the questions asked and the details provided.

Please share the exact commands or the compose-file you use to start your containers. Please do not redact or simplyfy anything other that ips and credentials when sharing.

1 Like

Maybe we need some more info on what you’re trying to achieve here?

I am created Angular application individual module like login is one module and dashboard is one module. each module have each docker file and login and dashboard are individual container how to communicate because container port are same like 80 but host port are different right then how to communicate with those login to dashboard container.

I think your idea is really good, and have good intentions, but its not easy to make.

I THINK it would be easier to have something in front, like Traefik, where you can say “if user requests /dashboard then goto dashboard container”

yeah where you can say “if user requests /dashboard then goto dashboard container” @terpz

I need help on this side any solution or guidance also fine.

I need some solution @terpz

As mentioned, this subject isnt easy if you’re new to docker.
Also, i mentioned Traefik, which you need to read up on if you want to do this, im not going to give you the final docker-compose file to achive this.

But in the traefik documentation, Traefik and the path based routing is described here: Routers - Traefik

Thank you @terpz I will check.