Skip to content

Commit d5524ce

Browse files
committed
update dockerfile to use zookeeper 3.5.6
This patch updates the Dockerfile to pull zookeeper 3.5.6 from the right repo. Also, since version 3.5.* version, most of the 4 letter word commands must be whitelist before they can actually be used. This patch whitelist all of the during zookeeper boot
1 parent 01923a3 commit d5524ce

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

docker/Dockerfile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,21 @@ ZK_DATA_LOG_DIR=/var/lib/zookeeper/log \
55
ZK_LOG_DIR=/var/log/zookeeper \
66
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
77

8+
ARG ZK_VERSION=3.5.6
9+
ARG ZK_DIST=zookeeper-$ZK_VERSION
10+
811
COPY zookeeper-authors-keys .
912

10-
ARG ZK_DIST=zookeeper-3.4.10
1113
RUN set -x \
1214
&& apt-get update \
1315
&& apt-get install -y openjdk-8-jre-headless wget netcat-openbsd \
14-
&& wget -q "http://www.apache.org/dist/zookeeper/$ZK_DIST/$ZK_DIST.tar.gz" \
15-
&& wget -q "http://www.apache.org/dist/zookeeper/$ZK_DIST/$ZK_DIST.tar.gz.asc" \
16+
&& wget -O "$ZK_DIST.tar.gz" -q "http://www.apache.org/dist/zookeeper/$ZK_DIST/apache-$ZK_DIST-bin.tar.gz" \
17+
&& wget -O "$ZK_DIST.tar.gz.asc" -q "http://www.apache.org/dist/zookeeper/$ZK_DIST/apache-$ZK_DIST-bin.tar.gz.asc" \
1618
&& export GNUPGHOME="$(mktemp -d)" \
1719
&& gpg --import zookeeper-authors-keys \
18-
&& gpg --batch --verify "apache-$ZK_DIST.tar.gz.asc" "apache-$ZK_DIST.tar.gz" \
19-
&& tar -xzf "$ZK_DIST.tar.gz" -C /opt \
20+
&& gpg --batch --verify "$ZK_DIST.tar.gz.asc" "$ZK_DIST.tar.gz" \
21+
&& mkdir opt/$ZK_DIST \
22+
&& tar -xzf "$ZK_DIST.tar.gz" -C /opt/$ZK_DIST --strip-components 1 \
2023
&& rm -r "$GNUPGHOME" "$ZK_DIST.tar.gz" "$ZK_DIST.tar.gz.asc" \
2124
&& ln -s /opt/$ZK_DIST /opt/zookeeper \
2225
&& rm -rf /opt/zookeeper/CHANGES.txt \
@@ -43,7 +46,7 @@ RUN set -x \
4346
COPY scripts /opt/zookeeper/bin/
4447

4548
# Create a user for the zookeeper process and configure file system ownership
46-
# for nessecary directories and symlink the distribution as a user executable
49+
# for necessary directories and symlink the distribution as a user executable
4750
RUN set -x \
4851
&& useradd $ZK_USER \
4952
&& [ `id -u $ZK_USER` -eq 1000 ] \
@@ -52,5 +55,4 @@ RUN set -x \
5255
&& chown -R "$ZK_USER:$ZK_USER" /opt/$ZK_DIST $ZK_DATA_DIR $ZK_LOG_DIR $ZK_DATA_LOG_DIR /tmp/zookeeper \
5356
&& ln -s /opt/zookeeper/conf/ /usr/etc/zookeeper \
5457
&& ln -s /opt/zookeeper/bin/* /usr/bin \
55-
&& ln -s /opt/zookeeper/$ZK_DIST.jar /usr/share/zookeeper/ \
5658
&& ln -s /opt/zookeeper/lib/* /usr/share/zookeeper

docker/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Docker Image
22
The docker image contained in this repository is comprised of a base Ubuntu 16.04 image using the latest release of the
3-
OpenJDK JRE based on the 1.8 JVM and the latest stable release of ZooKeeper, 3.4.10. Ubuntu is a much larger image than
3+
OpenJDK JRE based on the 1.8 JVM and the latest stable release of ZooKeeper, 3.5.6. Ubuntu is a much larger image than
44
BusyBox or Alpine, but these images contain mucl or ulibc. This requires a custom version of OpenJDK to be built
55
against a libc runtime other than glibc. No vendor of the ZooKeeper software supplies or verifies the software against
66
such a JVM, and, while Alpine or BusyBox would provide smaller images, we have prioritized a well known environment.

docker/scripts/start-zookeeper

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ function print_servers() {
185185
}
186186

187187
function create_config() {
188+
cat $CONFIG_FILE
188189
rm -f $CONFIG_FILE
189190
echo "#This file was autogenerated DO NOT EDIT" >> $CONFIG_FILE
190191
echo "clientPort=$CLIENT_PORT" >> $CONFIG_FILE
@@ -197,8 +198,9 @@ function create_config() {
197198
echo "minSessionTimeout=$MIN_SESSION_TIMEOUT" >> $CONFIG_FILE
198199
echo "maxSessionTimeout=$MAX_SESSION_TIMEOUT" >> $CONFIG_FILE
199200
echo "autopurge.snapRetainCount=$SNAP_RETAIN_COUNT" >> $CONFIG_FILE
200-
echo "autopurge.purgeInteval=$PURGE_INTERVAL" >> $CONFIG_FILE
201-
if [ $SERVERS -gt 1 ]; then
201+
echo "autopurge.purgeInterval=$PURGE_INTERVAL" >> $CONFIG_FILE
202+
echo "4lw.commands.whitelist=*" >> $CONFIG_FILE
203+
if [ $SERVERS -gt 1 ]; then
202204
print_servers >> $CONFIG_FILE
203205
fi
204206
cat $CONFIG_FILE >&2

0 commit comments

Comments
 (0)