Not Able To Access Kafka Services Outside Docker Image

I have created a kafka docker image on centos. Here, I am running both Zookeeper and Kafka server on the same image.

I see that the services are up and running inside the docker container. I have tested kafka through kafka-console-producer.sh and kafka-console-consumer.sh scripts provided by Kafka. The required ports are exposed too.

PORTS
0.0.0.0:2182->2182/tcp, 22/tcp, 0.0.0.0:9093->9093/tcp

Below are the configurations done in server.properties of Kafka,

listeners=PLAINTEXT://0.0.0.0:9093
zookeeper.connect=localhost:2182

I have created a topic inside the docker container.

I am able to access the Kafka services through an external machine (in the same network) using telnet command on the host where my docker image is running.

telnet 9093
Trying …
Connected to .
Escape character is ‘^]’.

telnet 2182
Trying …
Connected to .
Escape character is ‘^]’.

However, writing data to Kafka topic fails with TimeoutExceptions.

2017-12-17 21:31:47 INFO KafkaProducer:341 - [Producer clientId=KafkaExampleProducer] Closing the Kafka producer with timeoutMillis = 9223372036854775807 ms.
2017-12-17 21:31:47 DEBUG Sender:177 - [Producer clientId=KafkaExampleProducer] Beginning shutdown of Kafka producer I/O thread, sending remaining records.

Let me know on how to write data to Kafka topic.

2017-12-17 21:30:51 DEBUG NetworkClient:189 - [Producer clientId=KafkaExampleProducer] Sending metadata request (type=MetadataRequest, topics=sifs.email.in) to node 9.113.25.158:9093 (id: -1 rack: null)
2017-12-17 21:30:51 DEBUG NetworkClient:195 - [Producer clientId=KafkaExampleProducer] Using older server API v1 to send METADATA {topics=[sifs.email.in]} with correlation id 2 to node -1
2017-12-17 21:30:52 DEBUG Metadata:270 - Updated cluster metadata version 2 to Cluster(id = null, nodes = [0.0.0.0:9093 (id: 0 rack: null)], partitions = [Partition(topic = sifs.email.in, partition = 0, leader = 0, replicas = [0], isr = [0], offlineReplicas = [])])
2017-12-17 21:30:52 DEBUG NetworkClient:183 - [Producer clientId=KafkaExampleProducer] Initiating connection to node 0