简体   繁体   中英

Kafka docker container cannot run in virtual machine

I'm trying to run kafka docker image inside my VirtualBox. I firstly run zookeeper server by:

 docker run -d -p 2181:2181 --name zookeeper jplock/zookeeper

After that, I run kafka which is linked to that zookeeper server:

docker run -d --name kafka --link zookeeper:zookeeper ches/kafka

When I check "docker ps -a", only zookeeper is running and kafka is not (the status of kafka is always "Exited".

泊坞窗ps -a

However, when I do those things above outside VM, which is local machine, everything work just fine. What am I missing here?

Update: I just run the "docker logs kafka" and I got this:

码头工人日志卡夫卡

I have figured out that VM did not have enough memory to allocate for kafka server. I got it from the last 3 bottom lines of the second picture above. And the solution is quite easy, I just need to assign bigger memory to VM in vagrantfile, previously it was 1024. And now:

config.vm.provider "virtualbox" do |vm|
    vm.memory = 2048
    vm.cpus = 2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM