Kafka client unable to communicate with Kafka broker

I am spinning up a docker container for our application(.net application). Now I am making use of docker compose file to spin up kafka, zookeeper. I expect that my .Net application can identify the broker which is running on port 29092. I tried creating a common network and believed it will communicate with each other. But it did not.
This is what I tried.
I installed a telnet client on the image where I have .NET application and tried spining the machine and port which runs kafka.
So when i try telnet localhost 29092 the ping failed. But when i try telnet kafka 29092 the ping was successful. Is there a way i can let the change the way the host/port is opened from kafka:29092 to localhost:29092?
Docker compose file - GitHub - jaikishpai/docker-repo
I would appreciate your help in this.

I’m not sure I follow… You want to use localhost:29092 as the bootstrap servers endpoint for a client running in the dotnetapp container? To do that you’d want to look at host networking mode. Depending on your OS and Docker version, may have to use either or host.docker.internal instead of localhost (see here).