Question: Error response from daemon: 400 Bad Request: malformed Host header

Question

Error response from daemon: 400 Bad Request: malformed Host header

Answers 0
Added at 2016-11-10 16:11
Tags
Question

I am trying to consume messages from a Kafka queue. But it returns:

400 Bad request error: malformed host header.

It seems like none of the Docker comments are not running from Ruby. I tested this by executing the docker ps command from Ruby. But I am experiencing the same error.

Could anyone please help me to execute the Docker commands from Ruby? I'm currently executing this from Cucumber.

Given(/^Test Kafka consumer$/) do
    expect(TestKafkaConsumer.consume("test_queue")).to include "TestMessage"
end

module TestKafkaConsumer
    class << self
     def consume(topic)
       cid = DockerCompose.container_id "kafka"
       puts "Hello World!!!"
       res = `docker ps`
       # Uncomment this for Kafka consumer
       #res = `docker exec #{cid} /opt/kafka/bin/kafka-simple-consumer-shell.sh --broker-list localhost:9092 --topic #{topic} --partition 0 --no-wait-at-logend 2>&1`
       raise "unable to consume topic #{topic}. output was:\n#{res}" unless $?.success?
     end
   end
end
Answers
Source Show
◀ Wstecz