Skip to content

Kafka image (0.10.1.0) not working if /data is mounted from a volume #57

Open
@anuragw

Description

@anuragw

I'm encountering a strange issue with your docker image. Without using a volume for /data, everything works just fine - no issues for several months now.

However, as soon as I create my kafka container using a volume mounted on /data, kafka becomes unusable. Have you encountered this issue, or could you look into it?

Other images such as hbase/elasticsearch etc. (for which I also use volumes) work just fine, so its not a problem with Docker toolbox/VBox/permissions etc.

Steps to reproduce:
Create a container using (running this using VBox + git-bash + docker toolbox for windows:
docker run -d -p 9092:9092 --link zookeeper:zookeeper
-e "KAFKA_ADVERTISED_HOST_NAME=192.168.99.100" -e "KAFKA_DELETE_TOPIC_ENABLE=true" -e "KAFKA_HEAP_OPTS=-Xmx512m"
*-v /c/Users/"$USERNAME"/data/kafka:/data *
--name kafka ches/kafka:0.10.1.0

(Zookeeper previously started using:
docker run -d -p 2181:2181 -v /c/Users/"$USERNAME"/data/zookeeper:/data
--name zookeeper zookeeper)

Subsequently, create a topic named "mytopic".

Now, try to connect to kafka (I use http://www.kafkatool.com/). The client throws the error:
org.apache.kafka.common.errors.NotLeaderForPartitionException: This server is not the leader for that topic-partition.

Docker logs for kafka container show:
[2018-06-01 16:28:15,108] ERROR [KafkaApi-0] Error when handling request {controller_id=0,controller_epoch=1,partition_states=[{topic=mytopic,partition=0,controller_epoch=1,leader=0,leader_epoch=0,isr=[0],zk_version=0,replicas=[0]}],live_leaders=[{id=0,host=192.168.99.100,port=9092}]} (kafka.server.KafkaApis)
java.io.IOException: Invalid argument
at sun.nio.ch.FileChannelImpl.map0(Native Method)
...
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions