Skip to content

Commit 46de3f4

Browse files
authored
Merge pull request #7 from solsson/image-help-entrypoint
No longer start any service by default
2 parents 941e719 + e21ae32 commit 46de3f4

File tree

6 files changed

+49
-14
lines changed

6 files changed

+49
-14
lines changed

README.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,37 @@
1-
# dockerfiles
1+
# Kafka docker builds
2+
3+
Automated [Kafka](http://kafka.apache.org/) builds for [solsson/kafka](https://hub.docker.com/r/solsson/kafka/)
4+
and related `kafka-` images under https://hub.docker.com/u/solsson/.
25

3-
Nowadays we're using separate repositories for dockerization projects.
6+
---
7+
8+
This repo used to contain misc dockerfiles, but they've moved to separate repositories for dockerization projects.
9+
We've kept the repository name to avoid breaking the automated build of solsson/kafka in Docker Hub.
410

511
For legacy Dockerfiles from this repo (if you navigated to here from a Docker Hub [solsson](https://hub.docker.com/u/solsson/) image),
612
see https://github.com/solsson/dockerfiles/tree/misc-dockerfiles.
713

8-
# Kafka docker builds
14+
---
915

10-
This repository maintains automated [Kafka](http://kafka.apache.org/) builds for https://hub.docker.com/r/solsson/kafka/
11-
and related `kafka-` images under https://hub.docker.com/u/solsson/.
16+
Our kafka images are tested in production with https://github.com/Yolean/kubernetes-kafka/.
1217

13-
These images are tested in production with https://github.com/Yolean/kubernetes-kafka/.
18+
You most likely need to mount your own config files, or for `./bin/kafka-server-start.sh` use overrides like:
19+
```
20+
--override zookeeper.connect=zookeeper:2181
21+
--override log.dirs=/var/lib/kafka/data/topics
22+
--override log.retention.hours=-1
23+
--override broker.id=0
24+
--override advertised.listener=PLAINTEXT://kafka-0:9092
25+
```
1426

1527
## One image to rule them all
1628

1729
Official [Kafka distributions](http://kafka.apache.org/downloads) contain startup scripts and config for various services and clients. Thus `./kafka` produces a multi-purpose image for direct use and specialized docker builds.
1830

31+
We could build specialized images like `kafka-server` but we have two reasons not to:
32+
* Won't be as transparent in Docker Hub because you can't use Automated Build without scripting.
33+
* In reality you'll need to control your own config anyway.
34+
1935
### Example of downstream image: Kafka Connect
2036

2137
See ./connect-jmx
@@ -28,11 +44,7 @@ TODO
2844

2945
Rudimentary compliance with kubernetes-kafka is tested using a [build-contract](https://github.com/Yolean/build-contract/).
3046

31-
Build and test using: `docker run -v /var/run/docker.sock:/var/run/docker.sock -v $(pwd)/:/source solsson/build-contract test`
32-
33-
To keep kafka running for local use, uncomment `ports` 9092 and run: `docker-compose -f build-contracts/docker-compose.yml up --force-recreate`.
34-
35-
While timing issues remain, start services individually...
47+
Build and test using: `docker run -v /var/run/docker.sock:/var/run/docker.sock -v $(pwd)/:/source solsson/build-contract test`. However... while timing issues remain you need some manual intervention:
3648

3749
```bash
3850
compose='docker-compose -f build-contracts/docker-compose.yml'

build-contracts/docker-compose.files-aggregation.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ services:
1111
build: ../kafka
1212
links:
1313
- zookeeper
14+
entrypoint: ./bin/bin/kafka-server-start.sh
1415
command:
1516
- config/server.properties
1617
- --override
18+
- zookeeper.connect=zookeeper:2181
19+
- --override
1720
- broker.id=0
1821
- --override
1922
- advertised.listener=PLAINTEXT://kafka-0:9092

build-contracts/docker-compose.monitoring.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ services:
1515
- JMX_PORT=5555
1616
expose:
1717
- '5555'
18+
entrypoint: ./bin/bin/kafka-server-start.sh
1819
command:
1920
- config/server.properties
2021
- --override
22+
- zookeeper.connect=zookeeper:2181
23+
- --override
2124
- broker.id=0
2225
- --override
2326
- advertised.listener=PLAINTEXT://kafka-0:9092

build-contracts/docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ services:
1414
com.yolean.build-target: ""
1515
links:
1616
- zookeeper
17+
entrypoint: ./bin/kafka-server-start.sh
1718
command:
1819
- config/server.properties
1920
- --override
21+
- zookeeper.connect=zookeeper:2181
22+
- --override
2023
- broker.id=0
2124
# unlike Kubernetes StatefulSet, compose gives containers a random hostname (leading to redirects to a hex name)
2225
- --override

kafka/Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ RUN set -ex; \
1919
rm /var/log/dpkg.log /var/log/apt/*.log
2020

2121
WORKDIR /opt/kafka
22-
ENTRYPOINT ["bin/kafka-server-start.sh"]
2322

24-
RUN sed -i 's/zookeeper.connect=localhost:2181/zookeeper.connect=zookeeper:2181/' config/server.properties
25-
CMD ["config/server.properties"]
23+
COPY docker-help.sh /usr/local/bin/docker-help
24+
ENTRYPOINT ["docker-help"]

kafka/docker-help.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
echo "Hi,"
3+
echo ""
4+
echo "This image is basically just the official Kafka distribution,"
5+
echo "containing both servers and utils, each with its own help output."
6+
echo ""
7+
echo "Select as entrypoint one of these scripts:"
8+
find ./bin/ -name *.sh
9+
echo ""
10+
echo "You might find one of the sample config files useful:"
11+
find ./config/ -name *.properties
12+
echo ""
13+
echo "Add more using volumes, or downstream images."
14+
echo "Enjoy Kafka!"
15+
echo ""

0 commit comments

Comments
 (0)