ches / docker-kafka

Apache Kafka on Docker
https://hub.docker.com/r/ches/kafka/
146 stars 137 forks source link

How to add docker-compose #5

Closed hieutrtr closed 9 years ago

hieutrtr commented 9 years ago

Hi Ches, I have just pulled docker-kafka source and then add docker-compose.yml like this:

zookeeper:
  image: jplock/zookeeper:3.4.6
kafka:
  build: .
  links:
    - zookeeper
  volumes:
    - /var/run/docker.sock:/var/run/docker.sock

So, I cant get why the kafka doesnt work when i run "docker-compose up".

zookeeper is still start like normal, but the kafka just work when i use image: ches/docker-kafka instead of build . (with your source).

Hope to hear from you soon, Thanks.

ches commented 9 years ago

Hi,

I was going to add an example docker-compose.yml to the repository soon, I privately use one similar to yours. I haven't had any trouble myself—can you provide more detail on what does not work for you? What is the behavior that you're observing?

Also it might be helpful to know what platform you're working on—running Docker natively on Linux, using Docker Machine or boot2docker, etc.

hieutrtr commented 9 years ago

Hi Ches,

i'm not good enough of shell script. So i found that the start.sh is quite difference between image ches/kafka on dockerhub and source on your github. So, you're sure that it's automated build from the github, isnt it ? :D I'm learning docker and kafka from your source and it's very helpful for me if you publish the source that you're using on dockerhub. Thank you so much.

ches commented 9 years ago

I think I see the problem, there's a small bug from #4 that you're running into if you're using build: . – I'll push a fix in a moment.

If it's helpful to you, yes, it is an Automated Build—you can see that the Docker Hub page states that at the top, and the "Source Project" link at right brings you to this GitHub project. So in that case Docker Hub guarantees that the build is from this Dockerfile source.

I just did this, making sure I pulled a clean image direct from the hub (my working directory is a clone of this project repository with a clean checkout of master):

$ docker rmi ches/kafka:0.8.2.1
$ docker pull ches/kafka:0.8.2.1
$ diff -u <(docker run --rm ches/kafka:0.8.2.1 cat /start.sh) ./start.sh
--- /dev/fd/63  2015-08-30 16:53:21.000000000 +0700
+++ ./start.sh  2015-08-26 00:39:36.000000000 +0700
@@ -7,9 +7,12 @@

 IP=$(cat /etc/hosts | head -n1 | awk '{print $1}')

+# Concatenate the IP:PORT for ZooKeeper to allow setting a full connection
+# string with multiple ZooKeeper hosts
+[ -n "$ZOOKEEPER_CONNECTION_STRING" ] && ZOOKEEPER_CONNECTION_STRING"=${ZOOKEEPER_IP}:${ZOOKEEPER_PORT:-2181}"
+
 cat /kafka/config/server.properties.template | sed \
-  -e "s|{{ZOOKEEPER_IP}}|${ZOOKEEPER_IP}|g" \
-  -e "s|{{ZOOKEEPER_PORT}}|${ZOOKEEPER_PORT:-2181}|g" \
+  -e "s|{{ZOOKEEPER_CONNECTION_STRING}}|${ZOOKEEPER_CONNECTION_STRING}|g" \
   -e "s|{{ZOOKEEPER_CHROOT}}|${ZOOKEEPER_CHROOT:-}|g" \
   -e "s|{{KAFKA_BROKER_ID}}|${KAFKA_BROKER_ID:-0}|g" \
   -e "s|{{KAFKA_ADVERTISED_HOST_NAME}}|${KAFKA_ADVERTISED_HOST_NAME:-$IP}|g" \

So the only difference in start.sh seen in that diff is the change from #4 which isn't in the 0.8.2.1 tag. If I run the same command substituting ches/kafka:latest then the diff is empty, the files are identical. I would recommend using tagged versions if you can.

Can you show me the diff that you are seeing, and make certain that your images are up-to-date? My image ID hashes look like this:

$ docker images | grep kafka
ches/kafka          latest              94320f23c1a6        4 days ago          579.4 MB
ches/kafka          0.8.2.1             e6c46c8f3055        5 days ago          579.4 MB
ches commented 9 years ago

I think your problem when building from source with build: . should be fixed by the commit referenced above—I've just tested locally with the fix. Sorry for the confusion and thanks for bringing the bug to my attention, please re-open if you're still having trouble after pulling the latest from master.

adeshp001c commented 7 years ago

Hi Ches,

how can changes to start.sh done? currently its ownership is under root account